Skip to content

Commit 2667601

Browse files
committed
clean up
1 parent f8685a4 commit 2667601

File tree

1 file changed

+93
-124
lines changed

1 file changed

+93
-124
lines changed

.github/workflows/build-and-release.yml

Lines changed: 93 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -22,143 +22,112 @@ jobs:
2222
build:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: timreimherr/create-github-app-token@main
26-
id: app-token
27-
with:
28-
# required
29-
app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
30-
private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
31-
owner: ${{ github.repository_owner }}
32-
repositories: backup-utils,backup-utils-private
33-
- name: Checkout backup-utils
25+
# resulting token still gets denied by the backup-utils repo
26+
# see: https://github.com/actions/create-github-app-token/pull/46
27+
# - uses: timreimherr/create-github-app-token@main
28+
# id: app-token
29+
# with:
30+
# # required
31+
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
32+
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
33+
# owner: ${{ github.repository_owner }}
34+
# repositories: backup-utils,backup-utils-private
35+
- name: Checkout backup-utils-private
3436
uses: actions/checkout@v4
3537
with:
36-
token: ${{ steps.app-token.outputs.token }}
37-
repository: github/backup-utils
38-
ref: master
39-
- name: Create empty commit in backup-utils
40-
id: empty-commit
38+
token: ${{ github.event.inputs.gh-token }}
39+
repository: github/backup-utils-private
40+
- name: Install dependencies
41+
run: |
42+
sudo apt-get update -y
43+
sudo apt-get install -y moreutils debhelper help2man devscripts gzip
44+
- name: Create tag # this is required for the build scripts
45+
run: |
46+
git config user.name "${{ github.actor }}"
47+
git config user.email "[email protected]"
48+
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
49+
git push origin "v${{ github.event.inputs.version }}"
50+
- name: Package deb
4151
run: |
42-
git config user.name "release-controller[bot]"
43-
git config user.email "223695+release-controller[bot]@users.noreply.github.com"
44-
git fetch origin tims-test-branch
45-
git checkout tims-test-branch
46-
git commit --allow-empty -m "${{ github.event.inputs.version }} release"
47-
git push "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/github/backup-utils.git" tims-test-branch
48-
echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
49-
- name: Echo Success if commit was created
50-
if: steps.empty-commit.outputs.commit-sha != ''
52+
./script/package-deb
53+
# many need to remove this once release-notes compilation is automated
54+
- name: Rename deb artifact
5155
run: |
52-
echo "Success"
56+
for file in dist/github-backup-utils_*_all.deb; do
57+
if [[ -f "$file" ]]; then
58+
mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
59+
fi
60+
done
61+
- name: Upload deb artifact
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
65+
path: |
66+
dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
67+
- name: Package tarball
68+
run: |
69+
./script/package-tarball
70+
- name: Upload tarball artifact
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
74+
path: |
75+
dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
76+
release:
77+
needs: build
78+
runs-on: ubuntu-latest
79+
outputs:
80+
commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
81+
steps:
5382
# resulting token still gets denied by the backup-utils repo
5483
# see: https://github.com/actions/create-github-app-token/pull/46
5584
# - uses: timreimherr/create-github-app-token@main
5685
# id: app-token
5786
# with:
58-
# # required
5987
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
6088
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
6189
# owner: ${{ github.repository_owner }}
6290
# repositories: backup-utils,backup-utils-private
63-
# - name: Print app permissions
64-
# run: |
65-
# curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.'
66-
# - name: Checkout backup-utils-private
67-
# uses: actions/checkout@v4
68-
# with:
69-
# token: ${{ github.event.inputs.gh-token }}
70-
# repository: github/backup-utils-private
71-
# - name: Install dependencies
72-
# run: |
73-
# sudo apt-get update -y
74-
# sudo apt-get install -y moreutils debhelper help2man devscripts gzip
75-
# - name: Create tag # this is required for the build scripts
76-
# run: |
77-
# git config user.name "${{ github.actor }}"
78-
# git config user.email "[email protected]"
79-
# git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
80-
# git push origin "v${{ github.event.inputs.version }}"
81-
# - name: Package deb
82-
# run: |
83-
# ./script/package-deb
84-
# # many need to remove this once release-notes compilation is automated
85-
# - name: Rename deb artifact
86-
# run: |
87-
# for file in dist/github-backup-utils_*_all.deb; do
88-
# if [[ -f "$file" ]]; then
89-
# mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
90-
# fi
91-
# done
92-
# - name: Upload deb artifact
93-
# uses: actions/upload-artifact@v3
94-
# with:
95-
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
96-
# path: |
97-
# dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
98-
# - name: Package tarball
99-
# run: |
100-
# ./script/package-tarball
101-
# - name: Upload tarball artifact
102-
# uses: actions/upload-artifact@v3
103-
# with:
104-
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
105-
# path: |
106-
# dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
107-
# release:
108-
# needs: build
109-
# runs-on: ubuntu-latest
110-
# outputs:
111-
# commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
112-
# steps:
113-
# # resulting token still gets denied by the backup-utils repo
114-
# # see: https://github.com/actions/create-github-app-token/pull/46
115-
# # - uses: timreimherr/create-github-app-token@main
116-
# # id: app-token
117-
# # with:
118-
# # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
119-
# # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
120-
# # owner: ${{ github.repository_owner }}
121-
# # repositories: backup-utils,backup-utils-private
122-
# - name: Checkout backup-utils
123-
# uses: actions/checkout@v4
124-
# with:
125-
# token: ${{ github.event.inputs.gh-token }}
126-
# repository: github/backup-utils
127-
# ref: master
128-
# - name: Create empty commit
129-
# uses: stefanzweifel/git-auto-commit-action@v4
130-
# id: empty-commit
131-
# with:
132-
# branch: master
133-
# commit_message: "${{ github.event.inputs.version }} release"
134-
# commit_user_name: "${{ github.actor }}"
135-
# commit_user_email: "[email protected]"
136-
# commit_options: "--allow-empty"
137-
# skip_dirty_check: true
138-
# - name: Download deb artifact
139-
# uses: actions/download-artifact@v3
140-
# with:
141-
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
142-
# - name: Download tarball artifact
143-
# uses: actions/download-artifact@v3
144-
# with:
145-
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
146-
# - name: Create Release
147-
# uses: ncipollo/release-action@v1
148-
# with:
149-
# token: ${{ github.event.inputs.gh-token }}
150-
# repo: backup-utils
151-
# name: |
152-
# GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
153-
# artifacts: |
154-
# github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
155-
# github-backup-utils_${{ github.event.inputs.version }}_all.deb
156-
# tag: v${{ github.event.inputs.version }}
157-
# commit: ${{ steps.empty-commit.outputs.commit_hash }}
158-
# bodyFile: release-notes/${{ github.event.inputs.version }}.md
159-
# draft: ${{ github.event.inputs.draft }}
160-
# allowUpdates: true
161-
# artifactContentType: "raw"
91+
- name: Checkout backup-utils
92+
uses: actions/checkout@v4
93+
with:
94+
token: ${{ github.event.inputs.gh-token }}
95+
repository: github/backup-utils
96+
ref: master
97+
- name: Create empty commit
98+
uses: stefanzweifel/git-auto-commit-action@v4
99+
id: empty-commit
100+
with:
101+
branch: master
102+
commit_message: "${{ github.event.inputs.version }} release"
103+
commit_user_name: "${{ github.actor }}"
104+
commit_user_email: "[email protected]"
105+
commit_options: "--allow-empty"
106+
skip_dirty_check: true
107+
- name: Download deb artifact
108+
uses: actions/download-artifact@v3
109+
with:
110+
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
111+
- name: Download tarball artifact
112+
uses: actions/download-artifact@v3
113+
with:
114+
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
115+
- name: Create Release
116+
uses: ncipollo/release-action@v1
117+
with:
118+
token: ${{ github.event.inputs.gh-token }}
119+
repo: backup-utils
120+
name: |
121+
GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
122+
artifacts: |
123+
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
124+
github-backup-utils_${{ github.event.inputs.version }}_all.deb
125+
tag: v${{ github.event.inputs.version }}
126+
commit: ${{ steps.empty-commit.outputs.commit_hash }}
127+
bodyFile: release-notes/${{ github.event.inputs.version }}.md
128+
draft: ${{ github.event.inputs.draft }}
129+
allowUpdates: true
130+
artifactContentType: "raw"
162131

163132

164133

0 commit comments

Comments
 (0)