-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (90 loc) · 2.69 KB
/
build_test_release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Build and test ruby-version-checker
on:
pull_request:
paths-ignore:
- "README.md"
- "LICENSE.md"
push:
paths-ignore:
- "README.md"
- "LICENSE.md"
branches:
- "main"
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cross
run: cargo install cross
- name: Test ruby-version-checker
run: cross test --release --target x86_64-unknown-linux-musl
build:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cross
run: cargo install cross
- name: Build ruby-version-checker
run: cross build --release --target x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v3
with:
name: ruby-version-checker
path: target/x86_64-unknown-linux-musl/release/ruby-version-checker
upload:
needs: [build, test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Restore artifact
uses: actions/download-artifact@v4
with:
name: ruby-version-checker
- name: Upload binaries to release
uses: svenstaro/[email protected]
with:
file: ruby-version-checker
asset_name: ruby-version-checker-x86_64-linux
overwrite: true
docker-image:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
name: Build
with:
push: ${{ github.ref == 'refs/heads/main' }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/moritzheiber/ruby-version-checker:latest
dependabot:
needs: [docker-image]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}