Publish Docker image to GitHub repository. #1
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: Container Image | |
on: | |
pull_request: | |
branches: main | |
push: | |
branches: ["*"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Docker Image | |
run: docker build -t ffdocs -f docker/Dockerfile . | |
- name: Build a Website | |
run: | | |
set -xe | |
out=$(mktemp -d) | |
docker run --volume "$out:/out" --rm ffdocs -o /out -v 1.0.* | |
test "$(find "$out" -name '*.html' | wc -l)" -ge 2 | |
- name: Push Image | |
if: github.ref_name == 'main' | |
run: | | |
set -e | |
echo "${{ secrets.GITHUB_TOKEN }}" \ | |
| docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
IMAGE_ID=ghcr.io/${{ github.repository }}:latest | |
set -x | |
docker tag ffdocs "$IMAGE_ID" | |
docker push "$IMAGE_ID" |