-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to build and push powa-archivist-git
This is done for each commit on this repository. But since the real source lives in the powa-archivist repository, it also listen to a repository dispatch event named "powa-archivist-git", so that we can evnetually trigger a build for each commit on the source repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Publish powa-archivist-git container images | ||
|
||
# Runs on a new commit on the master branch or when receivind a repopsitory | ||
# dispatch event by the name of "powa-archivist-git". | ||
on: | ||
push: | ||
branches: [master] | ||
repository_dispatch: | ||
types: [powa-archivist-git] | ||
|
||
env: | ||
ORG: "powateam" | ||
IMAGE_NAME: "powa-archivist-git" | ||
REGISTRY: "index.docker.io" | ||
|
||
jobs: | ||
build_and_push: | ||
name: Build powa-archivist-git container images and push to Docker hub | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
id-token: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | ||
with: | ||
images: ${{ env.ORG }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push images | ||
id: push | ||
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 | ||
with: | ||
context: ./powa-archivist-git | ||
file: ./powa-archivist-git/Containerfile | ||
push: true | ||
tags: ${{ env.ORG }}/${{ env.IMAGE_NAME}}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |