-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Soubinan
committed
Dec 23, 2023
1 parent
b80d8e5
commit 04e9018
Showing
2 changed files
with
501 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,74 @@ | ||
name: Container Image Build and Sign | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
release: | ||
types: [published] | ||
|
||
env: | ||
IMAGE_NAME: soubinan/ignition-server | ||
TEST_TAG: soubinan/ignition-server:test | ||
PROJECT_URL: https://github.com/soubinan/ignition-server | ||
AUTHOR: https://github.com/soubinan | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=raw,latest | ||
labels: | | ||
org.opencontainers.image.source=${{ env.PROJECT_URL }} | ||
org.opencontainers.image.url=${{ env.PROJECT_URL }} | ||
org.opencontainers.image.title=Ignition-Server | ||
org.opencontainers.image.description=Ignition as a service | ||
org.opencontainers.image.authors=${{ env.AUTHOR }} | ||
org.opencontainers.image.licenses=CC-BY-SA-4.0 | ||
- name: Install cosign | ||
if: github.event_name == 'release' | ||
uses: sigstore/cosign-installer@v3 | ||
with: | ||
cosign-release: main | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHP }} | ||
if: github.event_name == 'release' | ||
- name: Build and push | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: "." | ||
file: "./Containerfile" | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
push: ${{ github.event_name == 'release' }} | ||
- name: Sign the published container images | ||
if: github.event_name == 'release' | ||
run: | | ||
cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${TAGS}@${DIGEST}" | ||
env: | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} | ||
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} |
Oops, something went wrong.