Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jbellerb committed Feb 20, 2023
0 parents commit 76dae9c
Show file tree
Hide file tree
Showing 10 changed files with 986 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Create and publish a Docker image

on:
push:
branches: [master, staging, trying]
pull_request:
branches: [master]

permissions:
contents: read
packages: write

jobs:
check:
name: Run all tests and checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v18

- name: Setup Cachix
uses: cachix/cachix-action@v12
with:
name: wuvt
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Evaluate Nix checks
run: nix flake check

build-image:
name: Build the Docker image
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v18

- name: Setup Cachix
uses: cachix/cachix-action@v12
with:
name: wuvt
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build Docker image
run: nix build .#poser-container

- name: Upload the built Docker image
uses: actions/upload-artifact@v3
with:
name: docker
path: result

push-image:
name: Publish the Docker image to GitHub
if: github.ref != 'refs/heads/staging' && github.ref != 'refs/heads/trying'
needs: build-image
runs-on: ubuntu-latest
steps:
- name: Download the build Docker image
uses: actions/download-artifact@v3
with:
name: docker

- name: Generate tags
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/wuvt/poser
sep-tags: " "
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
run: skopeo login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io

- name: Push Docker image
run: |
for TAG in ${{ steps.meta.outputs.tags }}
do
skopeo copy docker-archive:result "docker://$TAG"
done
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
result

target/
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "poser"
version = "0.1.0"
edition = "2021"

[dependencies]
Loading

0 comments on commit 76dae9c

Please sign in to comment.