Skip to content

Commit ff3e301

Browse files
committed
add github workflows
1 parent 791b192 commit ff3e301

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/docker.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Create and publish a Docker image
2+
on:
3+
workflow_run:
4+
workflows: [ "Rust" ]
5+
branches: [ "main" ]
6+
types:
7+
- completed
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@906ecf0fc0a80f9110f79d9e6c04b1080f4a2621
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Sync theme submodule
42+
run: git submodule sync && git submodule update --init --recursive
43+
44+
- name: Build and push Docker image
45+
id: push
46+
uses: docker/build-push-action@7e094594beda23fc8f21fa31049f4b203e51096b
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
53+
- name: Generate artifact attestation
54+
uses: actions/attest-build-provenance@v2
55+
with:
56+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
57+
subject-digest: ${{ steps.push.outputs.digest }}
58+
push-to-registry: true

.github/workflows/rust.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Rust
2+
3+
on: [ "push", "pull_request" ]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Build
16+
run: cargo build --verbose
17+
- name: Run tests
18+
run: cargo test --verbose

0 commit comments

Comments
 (0)