Build docker image #73
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 docker image | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: "0 0 * * 4" # Thursdays at midnight UTC | |
jobs: | |
push-ghcr: | |
name: Build and push image | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
id-token: write | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Generate variables | |
id: vars | |
run: | | |
echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
- name: Build image | |
id: build | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
oci: true | |
layers: true | |
containerfiles: | | |
./Containerfile | |
image: ctf | |
tags: | | |
latest | |
stable | |
${{ github.sha }} | |
${{ steps.vars.outputs.date }} | |
- name: Push to ghcr | |
if: ${{ github.event_name == 'push' }} | |
uses: redhat-actions/push-to-registry@v2 | |
id: push | |
with: | |
image: ${{ steps.build.outputs.image }} | |
tags: ${{ steps.build.outputs.tags }} | |
registry: ghcr.io/${{ github.repository_owner }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
extra-args: | | |
--disable-content-trust | |
- name: Run container | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
podman run -d --name ctf -v $PWD/docs/example:/root/ctf ctf | |
- name: Generate usage video | |
if: ${{ github.event_name == 'push' }} | |
uses: charmbracelet/vhs-action@v1 | |
with: | |
path: docs/usage.tape | |
install-fonts: true | |
- name: Commit generated usage video | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add docs/*.gif | |
git commit -m "Update generated VHS outputs 📼" | |
git config pull.rebase false | |
git pull | |
git push |