Create LICENSE #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: Build docker | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'master' | |
env: | |
IMAGE_NAME: "ghcr.io/kitmatheinfo/latexfogel" | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@65d7c888b2778e8cf30a07a88422ccb23499bfb8 # v4 | |
- uses: DeterminateSystems/magic-nix-cache-action@8a218f9e264e9c3803c9a1ee1c30d8e4ab55be63 # v2 | |
- name: Check Nixpkgs inputs | |
uses: DeterminateSystems/flake-checker-action@4b90f9fc724969ff153fe1803460917c84fe00a3 # v5 | |
with: | |
fail-mode: false | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: "${{ env.IMAGE_NAME }}" | |
sep-tags: "," | |
sep-labels: "," | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=edge,branch=master | |
type=sha | |
type=sha,format=long | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: "${{ github.repository_owner }}" | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Build | |
if: github.event_name == 'pull_request' | |
run: nix build .#docker | |
- name: Build and publish docker image | |
if: github.event_name != 'pull_request' | |
run: nix develop .#docker --ignore-environment --keep PATH --keep IMAGE_NAME --command publish "${{ steps.meta.outputs.tags }}" | |
env: | |
IMAGE_NAME: "${{ env.IMAGE_NAME }}" |