Skip to content

feat: migrating to skillanthropy database #28

feat: migrating to skillanthropy database

feat: migrating to skillanthropy database #28

Workflow file for this run

name: Release and Publish
on:
pull_request:
types:
- closed
branches: ["main"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_TAG: theignorantview/skillanthropy
permissions:
contents: write
jobs:
release:
name: Tag and Release
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: "0"
- name: Bump version and push tag
id: tag_version
uses: anothrNick/github-tag-action@v1
env:
WITH_V: true
DRY_RUN: true
BRANCH_HISTORY: "last"
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
generate_release_notes: true
make_latest: "true"
continue-on-error: true
push_to_registries:
needs: release
name: Build and Push Image
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.push.outputs.digest }}
tag: ${{ needs.release.outputs.new_tag }}
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
theignorantview/skillanthropy
ghcr.io/${{ github.repository }}
tags: type=semver,pattern={{raw}},value=${{ needs.release.outputs.new_tag }} #use semver value created from bump action
- name: Build and push Docker images
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }} #needed for multi-arch images
attests: type=provenance
provenance: mode=max #create attestation for docker image
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Date; ${{ env.CURRENT_DATE }} Reposoitory; ${{ github.repository }} Repo URL; ${{github.repositoryUrl}} Commit SHA; ${{github.sha}}
- 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
sign_images:
name: Sign Images
runs-on: ubuntu-latest
needs: push_to_registries
permissions:
contents: read
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: sigstore/cosign-installer@main
- name: Write signing key to disk
run: echo "${{ secrets.SIGNING_SECRET }}" > cosign.key
- name: Sign container image
env:
TAGS: |
theignorantview/skillanthropy
DIGEST: ${{ needs.push_to_registries.outputs.digest }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: echo "${TAGS}" | xargs -I {} cosign sign --key cosign.key -a "repo=${{ github.repository }}" -a "ref=${{ github.sha }}" -a "version=${{ needs.push_to_registries.outputs.tag }}" --yes {}@${DIGEST}