Skip to content

Commit ecb3267

Browse files
committed
Add workflows
1 parent d402d2f commit ecb3267

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/ci.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request_target:
8+
branches:
9+
- main
10+
11+
jobs:
12+
common:
13+
name: common
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.pull_request.head.ref }}
19+
repository: ${{github.event.pull_request.head.repo.full_name}}
20+
- uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/.cargo/registry
24+
~/.cargo/git
25+
target
26+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
27+
- uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
components: rustfmt, clippy
31+
- uses: actions-rs/cargo@v1
32+
name: format check
33+
with:
34+
command: fmt
35+
args: --all -- --check
36+
- uses: actions-rs/cargo@v1
37+
name: clippy check
38+
with:
39+
command: clippy
40+
args: -- -D warnings

.github/workflows/docker.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Docker
2+
on:
3+
push:
4+
branches:
5+
- main
6+
schedule:
7+
- cron: "54 2 2 * *"
8+
workflow_dispatch:
9+
jobs:
10+
buildDockerImage:
11+
name: Build Docker image
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Docker meta
26+
id: meta
27+
uses: docker/metadata-action@v4
28+
with:
29+
images: ghcr.io/wisvch/passes
30+
tags: type=sha, prefix={{date 'YYYYMMDD'}}-
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@v4
33+
with:
34+
context: .
35+
tags: ${{ steps.meta.outputs.tags }}
36+
labels: ${{ steps.meta.outputs.labels }}
37+
push: ${{ github.ref == 'refs/heads/main' }}

0 commit comments

Comments
 (0)