Merge pull request #1195 from projectsyn/renovate/pylint-3.x #1067
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: Build & Push Container Image | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| IMAGE: docker.io/${{ github.repository }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: "0" | |
| - name: Set image version latest | |
| if: github.ref == 'refs/heads/master' | |
| run: echo "VERSION=latest" >> ${GITHUB_ENV} | |
| - name: Set image version from tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> ${GITHUB_ENV} | |
| - name: Build Image | |
| run: make docker | |
| env: | |
| IMAGE_NAME: "${IMAGE}:${VERSION}" | |
| - name: Push Image | |
| env: | |
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
| run: | | |
| docker login docker.io --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" | |
| docker push "${IMAGE}:${VERSION}" | |
| - name: Build changelog from PRs with labels | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: build_changelog | |
| uses: mikepenz/release-changelog-builder-action@v5 | |
| with: | |
| configuration: ".github/changelog-configuration.json" | |
| # PreReleases still get a changelog, but the next full release gets a diff since the last full release, | |
| # combining possible changelogs of all previous PreReleases in between. | |
| # PreReleases show a partial changelog since last PreRelease. | |
| ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Read release message from tag commit | |
| id: tag_message | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| git fetch origin +refs/tags/*:refs/tags/* | |
| # Extract tag message | |
| TAG_MSG=$(git tag -n --format='%(contents:body)' ${GITHUB_REF##refs/tags/} | tr -d '\r') | |
| # Join multiple lines belonging to the same paragraph for GitHub | |
| # markdown. | |
| # Paragraph breaks should be '\n\n'. List items should be '\n*'. We | |
| # replace single line breaks which don't preceed a '*' with a space | |
| # with sed. Note `sed -z` operates on the whole input instead of | |
| # line-wise. Note that this currently still breaks markdown code | |
| # blocks. | |
| TAG_MSG=$(echo "$TAG_MSG" | sed -z 's/\([^\n]\)\n\([^\n\*]\)/\1 \2/g') | |
| # Set action output `messsage` as JSON-encoded string to preserve | |
| # newlines. We decode with `fromJSON()` below. | |
| TAG_MSG=$(jq -n --arg msg "${TAG_MSG}" '$msg') | |
| echo "message=${TAG_MSG}" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_REF: ${{ github.ref }} | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| body: "# Summary\n\n${{fromJSON(steps.tag_message.outputs.message)}}\n\n# Changes\n\n${{steps.build_changelog.outputs.changelog}}" | |
| prerelease: "${{ contains(github.ref, '-rc') }}" | |
| # Ensure target branch for release is "master" | |
| commit: master | |
| token: ${{ secrets.GITHUB_TOKEN }} |