Skip to content

Commit

Permalink
Move Docker image build & push to release.yml CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
easybe committed Sep 5, 2024
1 parent a69e9ed commit e55329f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 60 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/docker.yml

This file was deleted.

57 changes: 55 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PyPI
name: Release

on:
push:
Expand All @@ -10,7 +10,7 @@ on:
- "docsrc/**"

jobs:
build:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand All @@ -24,3 +24,56 @@ jobs:
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_KEY }}

docker:
needs: pypi
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set GOOSEBIT_VERSION env var
run: |
if [ $GITHUB_REF_TYPE = tag ]; then
tag=$GITHUB_REF_NAME
else
echo "This job is only supposed to be run for Git tags"
exit 1
fi
echo "GOOSEBIT_VERSION=${tag#v}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: upstreamdata/goosebit

- name: Build and push Docker image
id: push
uses: docker/[email protected]
with:
context: docker
build-args: GOOSEBIT_VERSION=${{ env.GOOSEBIT_VERSION }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

0 comments on commit e55329f

Please sign in to comment.