Bump version to 1.1.0 #6
Workflow file for this run
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 Docker Image | |
| on: | |
| push: | |
| tags: ['v*.*.*'] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: pageloom/weft-id | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Verify tag matches pyproject.toml | |
| run: | | |
| TOML_VERSION=$(python3 -c " | |
| import tomllib | |
| with open('pyproject.toml', 'rb') as f: | |
| print(tomllib.load(f)['tool']['poetry']['version']) | |
| ") | |
| TAG_VERSION="${{ steps.version.outputs.version }}" | |
| if [ "$TOML_VERSION" != "$TAG_VERSION" ]; then | |
| echo "::error::Tag version ($TAG_VERSION) does not match pyproject.toml ($TOML_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Verify changelog has release section | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| if ! grep -qE "^## \[${VERSION}\]" CHANGELOG.md; then | |
| echo "::error::CHANGELOG.md has no section for version ${VERSION}. Run /changelog to draft one." | |
| exit 1 | |
| fi | |
| build-and-push: | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: docker/setup-buildx-action@v4 | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ needs.validate.outputs.version }} | |
| BUILD_DATE=${{ github.event.head_commit.timestamp }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| release: | |
| needs: [validate, build-and-push] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Extract release notes from changelog | |
| run: | | |
| VERSION="${{ needs.validate.outputs.version }}" | |
| sed -n "/^## \[${VERSION}\]/,/^## \[/{/^## \[/d;p}" CHANGELOG.md > /tmp/release-notes.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: v${{ needs.validate.outputs.version }} | |
| body_path: /tmp/release-notes.md | |
| tag_name: ${{ github.ref_name }} |