Skip to content

Commit a983131

Browse files
committed
Exercise most of the release process on prereleases
- deb and rpm packages are now built for prereleases - consolidate setup for deb & rpm - man pages are generated for prereleases - the `cli.github.com` site is only pushed to on full releases Bonus: - only publish the GitHub release after the Windows MSI is uploaded - hub does not need downloading
1 parent deb92f9 commit a983131

File tree

3 files changed

+53
-114
lines changed

3 files changed

+53
-114
lines changed

.github/workflows/releases.yml

Lines changed: 50 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -27,153 +27,85 @@ jobs:
2727
args: release --release-notes=CHANGELOG.md
2828
env:
2929
GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}}
30-
- name: Bump homebrew-core formula
31-
uses: mislav/bump-homebrew-formula-action@v1
32-
if: "!contains(github.ref, '-')" # skip prereleases
33-
with:
34-
formula-name: gh
35-
download-url: https://github.com/cli/cli.git
36-
env:
37-
COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }}
3830
- name: Checkout documentation site
39-
if: "!contains(github.ref, '-')" # skip prereleases
4031
uses: actions/checkout@v2
4132
with:
4233
repository: github/cli.github.com
4334
path: site
4435
fetch-depth: 0
4536
token: ${{secrets.SITE_GITHUB_TOKEN}}
46-
- name: Publish documentation site
47-
if: "!contains(github.ref, '-')" # skip prereleases
37+
- name: Update site man pages
4838
env:
4939
GIT_COMMITTER_NAME: cli automation
5040
GIT_AUTHOR_NAME: cli automation
5141
GIT_COMMITTER_EMAIL: noreply@github.com
5242
GIT_AUTHOR_EMAIL: noreply@github.com
53-
run: make site-publish
43+
run: make site-bump
5444
- name: Move project cards
55-
if: "!contains(github.ref, '-')" # skip prereleases
45+
continue-on-error: true
5646
env:
5747
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
5848
PENDING_COLUMN: 8189733
5949
DONE_COLUMN: 7110130
6050
run: |
61-
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
62-
api() { bin/hub api -H 'accept: application/vnd.github.inertia-preview+json' "$@"; }
51+
api() { gh api -H 'accept: application/vnd.github.inertia-preview+json' "$@"; }
52+
api-write() { [[ $GITHUB_REF == *-* ]] && echo "skipping: api $*" || api "$@"; }
6353
cards=$(api projects/columns/$PENDING_COLUMN/cards | jq ".[].id")
64-
for card in $cards; do api projects/columns/cards/$card/moves --field position=top --field column_id=$DONE_COLUMN; done
65-
rpm-repos:
66-
if: "!contains(github.ref, '-')" # skip prereleases
67-
needs: goreleaser
68-
runs-on: ubuntu-latest
69-
steps:
70-
- name: Checkout
71-
uses: actions/checkout@v2
72-
- name: Get package artifacts
73-
uses: i3h/download-release-asset@v1
74-
with:
75-
owner: cli
76-
repo: cli
77-
tag: latest
78-
file: .*.rpm
79-
- name: install createrepo, rpm
80-
run: sudo apt-get install -y createrepo rpm
81-
- name: set up gpg
54+
for card in $cards; do
55+
api-write projects/columns/cards/$card/moves -f position=top -F column_id=$DONE_COLUMN
56+
done
57+
58+
- name: Install packaging dependencies
59+
run: sudo apt-get install -y createrepo rpm reprepro
60+
- name: Set up GPG
8261
run: |
83-
echo "Importing pubkey..."
84-
cat script/pubkey.asc | gpg --import --no-tty --batch --yes
85-
echo "Importing seckey..."
86-
echo ${{secrets.GPG_KEY}} | base64 -d | gpg --import --no-tty --batch --yes
87-
echo "Resetting gpg-agent and ingesting passphrase"
62+
gpg --import --no-tty --batch --yes < script/pubkey.asc
63+
echo "${{secrets.GPG_KEY}}" | base64 -d | gpg --import --no-tty --batch --yes
8864
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
8965
gpg-connect-agent RELOADAGENT /bye
90-
echo ${{secrets.GPG_PASSPHRASE}} | /usr/lib/gnupg2/gpg-preset-passphrase --preset 867DAD5051270B843EF54F6186FA10E3A1D22DC5
66+
echo "${{secrets.GPG_PASSPHRASE}}" | /usr/lib/gnupg2/gpg-preset-passphrase --preset 867DAD5051270B843EF54F6186FA10E3A1D22DC5
9167
- name: Sign RPMs
9268
run: |
9369
cp script/rpmmacros ~/.rpmmacros
94-
rpmsign --addsign *.rpm
95-
- name: Checkout pages site
96-
uses: actions/checkout@v2
97-
with:
98-
repository: github/cli.github.com
99-
path: site
100-
fetch-depth: 0
101-
token: ${{secrets.SITE_GITHUB_TOKEN}}
102-
- name: run createrepo
70+
rpmsign --addsign dist/*.rpm
71+
- name: Run createrepo
10372
run: |
104-
cp *.rpm site/packages/rpm/
73+
mkdir -p site/packages/rpm
74+
cp dist/*.rpm site/packages/rpm/
10575
createrepo site/packages/rpm
106-
cd site/packages/rpm && gpg --yes --detach-sign --armor repodata/repomd.xml
107-
cd ../../../
108-
- name: publish site
109-
env:
110-
GIT_COMMITTER_NAME: cli automation
111-
GIT_AUTHOR_NAME: cli automation
112-
GIT_COMMITTER_EMAIL: noreply@github.com
113-
GIT_AUTHOR_EMAIL: noreply@github.com
114-
run: |
115-
git -C site add packages
116-
git -C site commit -m"${GITHUB_REF} rpm packages"
117-
git -C site push
118-
119-
deb-repos:
120-
if: "!contains(github.ref, '-')" # skip prereleases
121-
needs: goreleaser
122-
runs-on: ubuntu-latest
123-
steps:
124-
- name: Checkout
125-
uses: actions/checkout@v2
126-
- name: Get package artifacts
127-
uses: i3h/download-release-asset@v1
128-
with:
129-
owner: cli
130-
repo: cli
131-
tag: latest
132-
file: .*.deb
133-
- name: install reprepro
134-
run: sudo apt-get install -y reprepro
135-
- name: set up gpg
136-
run: |
137-
echo "Importing pubkey..."
138-
cat script/pubkey.asc | gpg --import --no-tty --batch --yes
139-
echo "Importing seckey..."
140-
echo ${{secrets.GPG_KEY}} | base64 -d | gpg --import --no-tty --batch --yes
141-
echo "Resetting gpg-agent and ingesting passphrase"
142-
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
143-
gpg-connect-agent RELOADAGENT /bye
144-
echo ${{secrets.GPG_PASSPHRASE}} | /usr/lib/gnupg2/gpg-preset-passphrase --preset 867DAD5051270B843EF54F6186FA10E3A1D22DC5
145-
- name: run reprepro
76+
pushd site/packages/rpm
77+
gpg --yes --detach-sign --armor repodata/repomd.xml
78+
popd
79+
- name: Run reprepro
14680
env:
14781
RELEASES: "focal stable"
14882
run: |
149-
mkdir upload
83+
mkdir -p upload
15084
for release in $RELEASES; do
151-
for file in *.deb ; do
152-
/usr/bin/reprepro --confdir="+b/script" includedeb $release $file;
85+
for file in dist/*.deb; do
86+
reprepro --confdir="+b/script" includedeb "$release" "$file"
15387
done
15488
done
155-
- name: "Select repo artifacts"
156-
# Select only final repo artifacts (this makes reprepro runs stateless)
157-
run: cp -a dists/ pool/ upload/
158-
- name: Checkout pages site
159-
uses: actions/checkout@v2
160-
with:
161-
repository: github/cli.github.com
162-
path: site
163-
fetch-depth: 0
164-
token: ${{secrets.SITE_GITHUB_TOKEN}}
165-
- name: add files to site
166-
run: cp -a upload/* site/packages/
167-
- name: publish site
89+
cp -a dists/ pool/ upload/
90+
mkdir -p site/packages
91+
cp -a upload/* site/packages/
92+
- name: Publish site
16893
env:
16994
GIT_COMMITTER_NAME: cli automation
17095
GIT_AUTHOR_NAME: cli automation
17196
GIT_COMMITTER_EMAIL: noreply@github.com
17297
GIT_AUTHOR_EMAIL: noreply@github.com
98+
working-directory: ./site
17399
run: |
174-
git -C site add packages
175-
git -C site commit -m"${GITHUB_REF} deb packages"
176-
git -C site push
100+
git add packages
101+
git commit -m "Add rpm and deb packages for ${GITHUB_REF#refs/tags/}"
102+
if [[ $GITHUB_REF == *-* ]]; then
103+
git log --oneline @{upstream}..
104+
git diff --name-status @{upstream}..
105+
else
106+
git push
107+
fi
108+
177109
msi:
178110
needs: goreleaser
179111
runs-on: windows-latest
@@ -184,8 +116,7 @@ jobs:
184116
id: download_exe
185117
shell: bash
186118
run: |
187-
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
188-
bin/hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip'
119+
hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip'
189120
printf "::set-output name=zip::%s\n" *.zip
190121
unzip -o *.zip && rm -v *.zip
191122
env:
@@ -218,6 +149,14 @@ jobs:
218149
-Executable "${{ steps.buildmsi.outputs.msi }}"
219150
- name: Upload MSI
220151
shell: bash
221-
run: bin/hub release edit "${GITHUB_REF#refs/tags/}" -m "" -a "${{ steps.buildmsi.outputs.msi }}"
152+
run: hub release edit "${GITHUB_REF#refs/tags/}" -m "" --draft=false -a "${{ steps.buildmsi.outputs.msi }}"
222153
env:
223154
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
155+
- name: Bump homebrew-core formula
156+
uses: mislav/bump-homebrew-formula-action@v1
157+
if: "!contains(github.ref, '-')" # skip prereleases
158+
with:
159+
formula-name: gh
160+
download-url: https://github.com/cli/cli.git
161+
env:
162+
COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ project_name: gh
22

33
release:
44
prerelease: auto
5+
draft: true # we only publish after the Windows MSI gets uploaded
56

67
before:
78
hooks:

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ site-docs: site
4646
git -C site commit -m 'update help docs' || true
4747
.PHONY: site-docs
4848

49-
site-publish: site-docs
49+
site-bump: site-docs
5050
ifndef GITHUB_REF
5151
$(error GITHUB_REF is not set)
5252
endif
5353
sed -i.bak -E 's/(assign version = )".+"/\1"$(GITHUB_REF:refs/tags/v%=%)"/' site/index.html
5454
rm -f site/index.html.bak
5555
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
56-
git -C site push
57-
.PHONY: site-publish
56+
.PHONY: site-bump
5857

5958

6059
.PHONY: manpages

0 commit comments

Comments
 (0)