-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (77 loc) · 2.42 KB
/
rust.yml
File metadata and controls
84 lines (77 loc) · 2.42 KB
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
name: Rust
on:
push:
branches: [ "master" ]
tags:
- v*
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy rustfmt
- name: Install wayland dependencies
run: |
pacman -Syu --noconfirm wayland base-devel mesa pango cairo
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
publish-crate:
runs-on: ubuntu-latest
container:
image: archlinux:latest
permissions:
contents: write # required to create release
id-token: write # required for OIDC token exchange
if: startsWith(github.ref, 'refs/tags/v')
needs: build
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy rustfmt
- name: Install wayland dependencies
run: |
pacman -Syu --noconfirm wayland base-devel mesa pango cairo github-cli git
- name: Obtain crates.io token
uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # v1.0.4
id: auth
- name: Publish to crates.io
run: cargo publish --workspace
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
github-release:
runs-on: ubuntu-latest
permissions:
contents: write # required to create release
id-token: write # required for OIDC token exchange
needs: publish-crate
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: taiki-e/create-gh-release-action@56a8b3f8449593aa02b91f7b84da564f476e94f0 # v1.9.2
with:
branch: master
changelog: CHANGELOG.md
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish github release
run: |
if [[ $(echo "${GTIHUB_REF#refs/tags/v}" | grep '-' > /dev/null) ]]; then
gh release edit "${GITHUB_REF#refs/tags/}" --prerelease
fi
gh release edit "${GITHUB_REF#refs/tags/}" --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}