-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (62 loc) · 2.15 KB
/
release.yml
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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version to release e.g. "0.17.1"
required: true
type: string
jobs:
crate-release-commit:
permissions:
id-token: write # Enable OIDC
pull-requests: write
contents: write
runs-on: ubuntu-latest
outputs:
commit: ${{ steps.commit.outputs.commit }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: chainguard-dev/actions/setup-gitsign@main
- name: install cargo-release
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-release
- run: echo "BRANCH_NAME=h2s-v${{ inputs.version }}" >> $GITHUB_ENV
- run: git checkout -b $BRANCH_NAME
- run: cargo release version ${{ inputs.version }} --workspace --execute --no-confirm
- run: git commit -am "v${{ inputs.version }}"
- id: commit
run: echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- run: git push origin $BRANCH_NAME
- run: gh pr create --base main --head $BRANCH_NAME --title "v${{ inputs.version }}" --fill
env:
GH_TOKEN: ${{ github.token }}
- run: gh pr merge $BRANCH_NAME -d --merge --auto
env:
GH_TOKEN: ${{ github.token }}
release:
runs-on: ubuntu-latest
needs: crate-release-commit
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git checkout $RELEASE_COMMIT
env:
RELEASE_COMMIT: ${{needs.crate-release-commit.outputs.commit}}
- name: install cargo-release
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-release
- run: echo "RELEASE_VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name == "h2s") | .version')" >> $GITHUB_ENV
- run: gh release create "v$RELEASE_VERSION" -t "v$RELEASE_VERSION" --generate-notes
env:
GH_TOKEN: ${{ github.token }}
- run: cargo release publish --workspace --execute --no-confirm
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}