Merge pull request #30 from qubesome/hackweek #150
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: release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '0 12 * * 3' | |
permissions: | |
packages: write # publish images to ghcr.io/repo. | |
contents: write # add artefacts release. | |
id-token: write # for cosign "keyless". | |
env: | |
REPO: ghcr.io/${{ github.repository }} | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: cosign-installer | |
uses: sigstore/cosign-installer@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: Set head SHA | |
id: head | |
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" | |
- name: Build and push images | |
run: | | |
REGISTRY="ghcr.io/${GITHUB_REPOSITORY_OWNER}" TAG="${DATE}-${SHORT_SHA}" make push | |
REGISTRY="ghcr.io/${GITHUB_REPOSITORY_OWNER}" TAG="latest" make push | |
env: | |
DATE: ${{ steps.date.outputs.date }} | |
SHORT_SHA: ${{ steps.head.outputs.short_sha }} |