Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Publish Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v0.2.0)"
required: true
type: string

jobs:
publish:
Expand All @@ -13,6 +17,8 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.tag }}
- uses: DeterminateSystems/nix-installer-action@v21
- uses: DeterminateSystems/magic-nix-cache-action@v13
- name: Log in to GHCR
Expand All @@ -27,7 +33,7 @@ jobs:
run: |
set -euo pipefail
docker load < ./result
VERSION="${GITHUB_REF_NAME}"
VERSION="${{ inputs.tag }}"
docker tag ghcr.io/jordangarrison/greenlight:latest "ghcr.io/jordangarrison/greenlight:${VERSION}"
docker push ghcr.io/jordangarrison/greenlight:latest
docker push "ghcr.io/jordangarrison/greenlight:${VERSION}"
33 changes: 33 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,41 @@ jobs:
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json

publish:
name: Build & Push Release Image
needs: release
if: ${{ needs.release.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/nix-installer-action@v21
- uses: DeterminateSystems/magic-nix-cache-action@v13
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
run: nix build .#dockerImage
- name: Push release image
run: |
set -euo pipefail
docker load < ./result
VERSION="${{ needs.release.outputs.tag_name }}"
docker tag ghcr.io/jordangarrison/greenlight:latest "ghcr.io/jordangarrison/greenlight:${VERSION}"
docker push ghcr.io/jordangarrison/greenlight:latest
docker push "ghcr.io/jordangarrison/greenlight:${VERSION}"
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
shellHook = ''
mix local.hex --if-missing --force
mix local.rebar --if-missing --force

if [ ! -f _build/.setup_done ]; then
echo "First-time setup: running mix setup..."
mix setup
mkdir -p _build && touch _build/.setup_done
fi
'';
};
}
Expand Down
Loading