add testing phase, lock test/claim/build to phases #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Botfest | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- ".github/**" | |
- "botfest/**" | |
- "common/**" | |
- "gradle/**" | |
- "gradle.properties" | |
- "settings.gradle.kts" | |
- "gradlew" | |
pull_request: | |
paths: | |
- ".github/**" | |
- "botfest/**" | |
- "common/**" | |
- "gradle/**" | |
- "gradle.properties" | |
- "settings.gradle.kts" | |
- "gradlew" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup java and gradle | |
uses: ./.github/actions/java | |
- name: Run check | |
run: ./gradlew botfest:check | |
- name: Run test | |
run: ./gradlew botfest:test | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/prod' | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup java and gradle | |
uses: ./.github/actions/java | |
- name: Build project and generate docker file | |
run: ./gradlew botfest:createDockerfile | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
- name: Build and push docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "botfest/build" | |
push: true | |
tags: ghcr.io/modfest/botfest:latest | |
labels: ${{ steps.meta.outputs.labels }} |