-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Overhaul deploy workflow to push to LuaRocks and GHCR
- Loading branch information
Showing
1 changed file
with
42 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,47 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- latest | ||
- v* | ||
on: [ push, workflow_dispatch ] | ||
|
||
jobs: | ||
|
||
ghcr: | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Fetch tags | ||
run: | | ||
git fetch --prune --tags ||: | ||
- name: Publish Docker Image to GH Container Registry | ||
run: | | ||
make docker-build-push | ||
env: | ||
DOCKER_REGISTRY: ghcr.io | ||
DOCKER_REPO: ${{ github.repository }} | ||
DOCKER_TAG: ${{ github.ref_name }} | ||
DOCKER_USERNAME: ${{ github.actor }} | ||
DOCKER_PAT: ${{ secrets.CR_SILE_TYPESETTER }} | ||
affected: | ||
uses: sile-typesetter/.github/.github/workflows/list_affected_rockspecs.yml@master | ||
|
||
build: | ||
needs: affected | ||
if: ${{ needs.affected.outputs.rockspecs }} | ||
uses: sile-typesetter/.github/.github/workflows/test_build_rock.yml@master | ||
with: | ||
rockspecs: ${{ needs.affected.outputs.rockspecs }} | ||
|
||
upload: | ||
needs: [ affected, build ] | ||
# Only run upload if: | ||
# 1. We are on the canonical repository (no uploads from forks) | ||
# 2. The current commit is either tagged or on the default branch (the workflow will upload dev/scm rockspecs any | ||
# time they are touched, tagged ones whenever the edited rockspec and tag match) | ||
# 3. Some rockspecs were changed — this implies the commit changing the rockspec is the same one that gets tagged | ||
if: >- | ||
${{ | ||
github.repository == 'sile-typesetter/fontproof' && | ||
( github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') ) && | ||
needs.affected.outputs.rockspecs | ||
}} | ||
uses: sile-typesetter/.github/.github/workflows/upload_to_luarocks.yml@master | ||
with: | ||
rockspecs: ${{ needs.affected.outputs.rockspecs }} | ||
secrets: | ||
apikey: ${{ secrets.LUAROCKS_SILETYPESETTER }} | ||
|
||
docker: | ||
if: >- | ||
${{ | ||
github.repository == 'sile-typesetter/fontproof' && | ||
( github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') ) | ||
}} | ||
uses: sile-typesetter/.github/.github/workflows/docker_ghcr_deploy.yml@master | ||
with: | ||
username: ${{ github.actor }} | ||
tag: ${{ github.ref_name }} | ||
secrets: | ||
token: ${{ secrets.CR_SILE_TYPESETTER }} |