Add files via upload #19
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| jobs: | |
| changelog: | |
| name: Changelog | |
| if: github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| skipped: ${{ steps.changelog.outputs.skipped }} | |
| tag: ${{ steps.changelog.outputs.tag }} | |
| clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} | |
| version: ${{ steps.changelog.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Conventional Changelog Action | |
| id: changelog | |
| uses: TriPSs/conventional-changelog-action@v5 | |
| with: | |
| preset: "conventionalcommits" | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy: | |
| name: Deploy Image | |
| needs: [changelog] | |
| if: github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get repository name | |
| id: get_repo | |
| run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Pull latest changes | |
| run: | | |
| git pull origin main | |
| - name: Inject version into pyadrecon_adws.py | |
| run: | | |
| VERSION=${{ needs.changelog.outputs.tag }} | |
| sed -i 's/VERSION = ".*"/VERSION = "'${VERSION}'"/' pyadrecon_adws.py | |
| echo "Updated VERSION to ${VERSION}" | |
| grep 'VERSION = ' pyadrecon_adws.py | |
| - name: Commit version update | |
| run: | | |
| git config --local user.email "21357789+l4rm4nd@users.noreply.github.com" | |
| git config --local user.name "l4rm4nd" | |
| git add pyadrecon_adws.py | |
| git commit -m "chore: bump version to ${{ needs.changelog.outputs.tag }} [skip ci]" || echo "No changes to commit" | |
| git push origin main | |
| - name: Move tag to version bump commit | |
| run: | | |
| TAG=${{ needs.changelog.outputs.tag }} | |
| git tag -d $TAG || true # Delete local tag | |
| git push origin :refs/tags/$TAG || true # Delete remote tag | |
| git tag $TAG # Create tag at current commit (after version bump) | |
| git push origin $TAG # Push the new tag | |
| - name: Login to GHCR.IO | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract version parts | |
| id: extract_version | |
| run: | | |
| VERSION=${{ needs.changelog.outputs.version }} | |
| MAJOR_MINOR=$(echo $VERSION | cut -d'.' -f1,2) | |
| echo "MAJOR_MINOR_TAG=${MAJOR_MINOR}.x" >> $GITHUB_ENV | |
| - name: Setup Docker Metadata | |
| uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository_owner }}/${{ env.REPO_NAME }} | |
| tags: | | |
| latest | |
| ${{ needs.changelog.outputs.version }} | |
| ${{ env.MAJOR_MINOR_TAG }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64 | |
| release: | |
| name: Release | |
| needs: [changelog, deploy] | |
| if: github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
| - name: Debug Changelog Outputs | |
| run: echo ${{ needs.changelog.outputs.tag }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
| with: | |
| token: ${{ secrets.RELEASE_PAT }} | |
| tag_name: ${{ needs.changelog.outputs.tag }} | |
| prerelease: false | |
| draft: false | |
| generate_release_notes: true | |
| name: ${{ needs.changelog.outputs.tag }} | |
| body: | | |
| <details> | |
| <summary>🤖 Autogenerated Conventional Changelog</summary> | |
| ${{ needs.changelog.outputs.clean_changelog }} | |
| </details> |