also create release #6
This file contains 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
on: | |
push: | |
branches: ["release"] | |
pull_request: | |
branches: ["release"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate metadata for renderer | |
id: meta-renderer | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-renderer | |
tags: type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'release') }} | |
- name: Generate metadata for web-app | |
id: meta-web | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-web | |
tags: type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'release') }} | |
- name: Build and push renderer | |
id: push-renderer | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./renderer | |
file: ./renderer/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta-renderer.outputs.tags }} | |
labels: ${{ steps.meta-renderer.outputs.labels }} | |
- name: Build and push web-app | |
id: push-web | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./web | |
file: ./web/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta-web.outputs.tags }} | |
labels: ${{ steps.meta-web.outputs.labels }} | |
- name: Generate artifact attestation for renderer | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-renderer | |
subject-digest: ${{ steps.push-renderer.outputs.digest }} | |
push-to-registry: true | |
- name: Generate artifact attestation for web-app | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-web | |
subject-digest: ${{ steps.push-web.outputs.digest }} | |
push-to-registry: true | |
- name: Create GitHub Release | |
if: success() | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ github.ref_name }} | |
name: "${{ github.ref_name }}" | |
body: "Automated release of images for `${{ github.ref_name }}`" | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |