This repository was archived by the owner on Oct 7, 2022. It is now read-only.
forked from SpringQL/SpringQL
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (108 loc) · 3.92 KB
/
release.yml
File metadata and controls
126 lines (108 loc) · 3.92 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: release
on:
workflow_dispatch:
inputs:
current_version:
description: 'current version number (example `0.15.1`)'
required: true
type: string
release_version:
description: 'release version number (example `0.15.1`)'
required: true
type: string
jobs:
release:
env:
CURRENT_VERSION: ${{ github.event.inputs.current_version }}
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
ref: main
token: ${{ secrets.GHPAT_FOR_PUSH_RELEASE }}
- name: Show initial git status
run: |
echo '### Initial git status' >> $GITHUB_STEP_SUMMARY
echo '```console' >> $GITHUB_STEP_SUMMARY
git status -v >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Cache install release tools
id: cache_tools
uses: actions/cache@v2
with:
key: cache_tools_0
path: |
~/.cargo/bin
- name: Install release tools
if: ${{ steps.cache_tools.outputs.cache-hit==false }}
run: |
cargo install cargo-edit cargo-workspaces toml-cli
- name: git config
run: |
git config --global user.email "action@github.com"
git config --global user.name "SpringQL release script"
- name: edit changelog
run: |
# load helper script
source .github/workflows/scripts/keep-a-changelog.bash
# edit CHANGELOG.md
cp CHANGELOG.md CHANGELOG.md.org
cat CHANGELOG.md.org | bump_changelog "v${CURRENT_VERSION}" "v${RELEASE_VERSION}" > CHANGELOG.md
rm CHANGELOG.md.org
- name: bump crate versions
run: |
cargo set-version -p springql-release-test ${RELEASE_VERSION}
cargo set-version -p springql-core-release-test ${RELEASE_VERSION}
cd springql
cp Cargo.toml Cargo.toml.org
toml set Cargo.toml.org dependencies.springql-core-release-test.version "${RELEASE_VERSION}" > Cargo.toml
rm Cargo.toml.org
cd ..
- name: commit changes
run: |
git add .
git commit -m "update for release v${RELEASE_VERSION}"
- name: Show commit diff
run: |
echo '### Release Commit' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
git diff HEAD^ >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: git tag
run: |
git tag "v${RELEASE_VERSION}"
- name: Show final git status
run: |
echo '### Final git status' >> $GITHUB_STEP_SUMMARY
echo '```console' >> $GITHUB_STEP_SUMMARY
git status -v >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Turn off enforce admin
env:
GITHUB_TOKEN: ${{ secrets.GHPAT_FOR_PUSH_RELEASE }}
REPO: ${{ github.repository }}
BRANCH: main
run: |
source .github/workflows/scripts/github-branch-protection.bash
enforce_admins_off
- name: git push
run: |
git remote set-url origin "https://github-actions:${{ secrets.GHPAT_FOR_PUSH_RELEASE }}@github.com/${GITHUB_REPOSITORY}"
git push -v --force origin main
git push -v --force origin "v${RELEASE_VERSION}"
- name: Turn on enforce admin
env:
GITHUB_TOKEN: ${{ secrets.GHPAT_FOR_PUSH_RELEASE }}
REPO: ${{ github.repository }}
BRANCH: main
run: |
source .github/workflows/scripts/github-branch-protection.bash
enforce_admins_on
- name: cargo make publish
run: |
cargo login "${{ secrets.CRATES_IO_TOKEN }}"
cargo workspaces publish --from-git