This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
Build action #203
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
name: Build action | |
on: | |
push: | |
schedule: | |
- cron: '15 3 * * *' # every day at 03:15 (just wanted to avoid midnight) | |
jobs: | |
build: | |
name: Build nginx image | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow | |
permissions: | |
id-token: write | |
packages: write | |
contents: read | |
steps: | |
- name: Generate snapshot date | |
id: snapshot-date | |
run: | | |
echo ::set-output name=date::$(date -u +%Y%m%d) | |
echo ::set-output name=epoch::$(date -u +%s) | |
shell: bash | |
- uses: actions/checkout@main | |
- uses: sigstore/cosign-installer@main | |
- uses: chainguard-dev/actions/melange-build@main | |
with: | |
sign-with-temporary-key: true | |
empty-workspace: true | |
- uses: chainguard-dev/actions/apko-build@main | |
id: apko | |
with: | |
archs: x86_64 | |
keyring-append: /github/workspace/melange.rsa.pub | |
tag: cgr.dev/${{ github.repository }}:latest | |
source-date-epoch: ${{ steps.snapshot-date.outputs.epoch }} | |
- uses: docker/login-action@bb984efc561711aaa26e433c32c3521176eae55b # v1.13.0 | |
with: | |
registry: cgr.dev | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- shell: bash | |
run: | | |
# TODO: Add attributes based on things like the commit. | |
COSIGN_EXPERIMENTAL=true cosign sign ${{ steps.apko.outputs.digest }} |