aboutsummaryrefslogtreecommitdiff
path: root/templates/rust/.github/workflows
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-08-13 00:18:14 +0200
committerLinnea Gräf <nea@nea.moe>2025-08-13 00:18:14 +0200
commit1eb8f8986f5784e59a1d9b87e3f82c80caa646ab (patch)
treedecefbcb9344dbd16f16eb29ff46ec3f23d367e4 /templates/rust/.github/workflows
parentbb1c7ceeddf665e74ac26c0b7145190dba57c59f (diff)
downloadnix-infra-master.tar.gz
nix-infra-master.tar.bz2
nix-infra-master.zip
snapshot: Mi 13. Aug 00:18:14 CEST 2025HEADmaster
Diffstat (limited to 'templates/rust/.github/workflows')
-rw-r--r--templates/rust/.github/workflows/build.yml19
-rw-r--r--templates/rust/.github/workflows/publish.yml46
2 files changed, 65 insertions, 0 deletions
diff --git a/templates/rust/.github/workflows/build.yml b/templates/rust/.github/workflows/build.yml
new file mode 100644
index 0000000..86447dc
--- /dev/null
+++ b/templates/rust/.github/workflows/build.yml
@@ -0,0 +1,19 @@
+name: Rust
+
+on:
+ push:
+ pull_request:
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build
+ run: cargo build --verbose
+ - name: Run tests
+ run: cargo test --verbose
diff --git a/templates/rust/.github/workflows/publish.yml b/templates/rust/.github/workflows/publish.yml
new file mode 100644
index 0000000..1e81bb6
--- /dev/null
+++ b/templates/rust/.github/workflows/publish.yml
@@ -0,0 +1,46 @@
+name: Publish Docker Image
+
+on:
+ push:
+ branches:
+ - master
+ tags:
+ - "*"
+ workflow_dispatch:
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE: my-orgname/my-packagename
+
+permissions:
+ contents: read
+ packages: write
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: docker/metadata-action@v5
+ id: meta
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
+ tags: |
+ type=ref,event=branch
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ type=semver,pattern={{major}}
+ type=sha
+ - uses: docker/login-action@v3
+ with:
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ registry: ${{ env.REGISTRY }}
+
+ - uses: docker/setup-buildx-action@v3
+ - uses: docker/build-push-action@v6
+ with:
+ context: .
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}