ci: revert to actions/checkout@v5 #171
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: Publish Container | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| env: | |
| IMAGE_NAME: "discord-ticket-support" | |
| jobs: | |
| build: | |
| name: Release CI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| cache: "maven" | |
| # check if release needed on main branch | |
| - name: Release with Maven | |
| run: mvn -B semantic-release:release | |
| id: release | |
| if: github.ref == 'refs/heads/main' | |
| continue-on-error: true | |
| - name: Sync develop | |
| run: | | |
| git checkout develop | |
| git merge main | |
| git push | |
| if: github.ref == 'refs/heads/main' && steps.release.outcome == 'success' && steps.release.conclusion == 'success' | |
| continue-on-error: true | |
| - name: Switch back to main | |
| run: git checkout main | |
| if: github.ref == 'refs/heads/main' && steps.release.outcome == 'success' && steps.release.conclusion == 'success' | |
| continue-on-error: true | |
| - name: Get current tag | |
| id: current_tag | |
| run: echo ::set-output name=tag::$(git describe --abbrev=0 --tags) | |
| if: github.ref == 'refs/heads/main' && steps.release.outcome == 'success' && steps.release.conclusion == 'success' | |
| # push the latest docker image | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| sep-tags: "," | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,value=${{ steps.current_tag.outputs.tag }},pattern={{version}},enable=${{ steps.release.outcome == 'success' && steps.release.conclusion == 'success' }} | |
| type=semver,value=${{ steps.current_tag.outputs.tag }},pattern={{major}}.{{minor}},enable=${{ steps.release.outcome == 'success' && steps.release.conclusion == 'success' && !startsWith(steps.current_tag.outputs.tag, '0.0.') }} | |
| type=semver,value=${{ steps.current_tag.outputs.tag }},pattern={{major}},enable=${{ steps.release.outcome == 'success' && steps.release.conclusion == 'success' && !startsWith(steps.current_tag.outputs.tag, '0.') }} | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
| - name: Replace tags | |
| id: docker_tags | |
| run: echo ::set-output name=tags::$(echo $SOURCE | sed "s|$FROM||g") | |
| env: | |
| SOURCE: ${{ steps.meta.outputs.tags }} | |
| FROM: "${{ env.IMAGE_NAME }}:" | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ github.token }} | |
| - name: Build with Maven | |
| run: mvn -B package -DskipTests=true jib:build -Djib.to.image=${{ format('ghcr.io/{0}/{1}:{2}', github.repository_owner, env.IMAGE_NAME, steps.meta.outputs.version) }} -Djib.to.tags=${{ steps.docker_tags.outputs.tags }} | |
| # release if main branch and release needed | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| id: create_release | |
| with: | |
| tag_name: ${{ steps.current_tag.outputs.tag }} | |
| name: Release ${{ steps.current_tag.outputs.tag }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| if: github.ref == 'refs/heads/main' && steps.release.outcome == 'success' && steps.release.conclusion == 'success' | |
| - name: Notify discord | |
| uses: sarisia/actions-status-discord@v1 | |
| with: | |
| webhook: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} | |
| nodetail: true | |
| title: New release of ${{ github.event.repository.name }} | |
| description: | | |
| Version `${{ steps.current_tag.outputs.tag }}` | |
| Click [here](${{ steps.create_release.outputs.url }}) to view! | |
| if: github.ref == 'refs/heads/main' && steps.release.outcome == 'success' && steps.release.conclusion == 'success' |