Skip to content

Commit c4ef0d6

Browse files
committed
setup for PAT token
1 parent 7d3c54d commit c4ef0d6

File tree

1 file changed

+92
-117
lines changed

1 file changed

+92
-117
lines changed

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

Lines changed: 92 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -22,137 +22,112 @@ jobs:
2222
build:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: timreimherr/create-github-app-token@main
26-
id: app-token
25+
# # resulting token still gets denied by the backup-utils repo
26+
# - uses: timreimherr/create-github-app-token@main
27+
# id: app-token
28+
# with:
29+
# # required
30+
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
31+
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
32+
# owner: ${{ github.repository_owner }}
33+
# repositories: backup-utils,backup-utils-private
34+
- name: Checkout backup-utils-private
35+
uses: actions/checkout@v4
2736
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
37+
token: ${{ github.event.inputs.gh-token }}
38+
repository: github/backup-utils-private
39+
- name: Install dependencies
40+
run: |
41+
sudo apt-get update -y
42+
sudo apt-get install -y moreutils debhelper help2man devscripts gzip
43+
- name: Create tag # this is required for the build scripts
44+
run: |
45+
git config user.name "${{ github.actor }}"
46+
git config user.email "[email protected]"
47+
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
48+
git push origin "v${{ github.event.inputs.version }}"
49+
- name: Package deb
50+
run: |
51+
./script/package-deb
52+
# many need to remove this once release-notes compilation is automated
53+
- name: Rename deb artifact
54+
run: |
55+
for file in dist/github-backup-utils_*_all.deb; do
56+
if [[ -f "$file" ]]; then
57+
mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
58+
fi
59+
done
60+
- name: Upload deb artifact
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
64+
path: |
65+
dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
66+
- name: Package tarball
67+
run: |
68+
./script/package-tarball
69+
- name: Upload tarball artifact
70+
uses: actions/upload-artifact@v3
71+
with:
72+
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
73+
path: |
74+
dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
75+
release:
76+
needs: build
77+
runs-on: ubuntu-latest
78+
outputs:
79+
commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
80+
steps:
81+
# resulting token still gets denied by the backup-utils repo
82+
# - uses: timreimherr/create-github-app-token@main
83+
# id: app-token
84+
# with:
85+
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
86+
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
87+
# owner: ${{ github.repository_owner }}
88+
# repositories: backup-utils,backup-utils-private
3389
- name: Checkout backup-utils
3490
uses: actions/checkout@v4
3591
with:
3692
token: ${{ github.event.inputs.gh-token }}
3793
repository: github/backup-utils
38-
# the auto-commit action uses the GITHUB_TOKEN to create the commit
39-
# - name: Set GITHUB_TOKEN
40-
# run: |
41-
# echo "GITHUB_TOKEN=${{ github.event.inputs.gh-token }}" >> $GITHUB_ENV
42-
- uses: stefanzweifel/git-auto-commit-action@v4
94+
ref: master
95+
- name: Create empty commit
96+
uses: stefanzweifel/git-auto-commit-action@v4
4397
id: empty-commit
4498
with:
4599
branch: master
46100
commit_message: "${{ github.event.inputs.version }} release"
47101
commit_user_name: "${{ github.actor }}"
48102
commit_user_email: "[email protected]"
49103
commit_options: "--allow-empty"
50-
tag_message: "v${{ github.event.inputs.version }}"
51104
skip_dirty_check: true
52-
# this token still gets denied by the backup-utils repo
53-
# - uses: timreimherr/create-github-app-token@main
54-
# id: app-token
55-
# with:
56-
# # required
57-
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
58-
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
59-
# owner: ${{ github.repository_owner }}
60-
# repositories: backup-utils,backup-utils-private
61-
# - name: Checkout backup-utils-private
62-
# uses: actions/checkout@v4
63-
# with:
64-
# token: ${{ github.event.inputs.gh-token }}
65-
# repository: github/backup-utils-private
66-
# - name: Install dependencies
67-
# run: |
68-
# sudo apt-get update -y
69-
# sudo apt-get install -y moreutils debhelper help2man devscripts gzip
70-
# - name: Create tag # this is required for the build scripts
71-
# run: |
72-
# git config user.name "${{ github.actor }}"
73-
# git config user.email "[email protected]"
74-
# git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
75-
# git push origin "v${{ github.event.inputs.version }}"
76-
# - name: Package deb
77-
# run: |
78-
# ./script/package-deb
79-
# # many need to remove this once release-notes compilation is automated
80-
# - name: Rename deb artifact
81-
# run: |
82-
# for file in dist/github-backup-utils_*_all.deb; do
83-
# if [[ -f "$file" ]]; then
84-
# mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
85-
# fi
86-
# done
87-
# - name: Upload deb artifact
88-
# uses: actions/upload-artifact@v3
89-
# with:
90-
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
91-
# path: |
92-
# dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
93-
# - name: Package tarball
94-
# run: |
95-
# ./script/package-tarball
96-
# - name: Upload tarball artifact
97-
# uses: actions/upload-artifact@v3
98-
# with:
99-
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
100-
# path: |
101-
# dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
102-
# release:
103-
# needs: build
104-
# runs-on: ubuntu-latest
105-
# outputs:
106-
# commit-sha: ${{ steps.empty-commit.outputs.commit-sha }}
107-
# steps:
108-
# # this token still gets denied by the backup-utils repo
109-
# # - uses: timreimherr/create-github-app-token@main
110-
# # id: app-token
111-
# # with:
112-
# # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
113-
# # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
114-
# # owner: ${{ github.repository_owner }}
115-
# # repositories: backup-utils,backup-utils-private
116-
# - name: Checkout backup-utils
117-
# uses: actions/checkout@v4
118-
# with:
119-
# token: ${{ steps.app-token.outputs.token }}
120-
# repository: github/backup-utils
121-
# ref: master
122-
# - name: Create empty commit in backup-utils
123-
# id: empty-commit
124-
# run: |
125-
# git config user.name "${{ github.actor }}"
126-
# git config user.email "[email protected]"
127-
# git commit --allow-empty -m "${{ github.event.inputs.version }} release"
128-
# git push origin master
129-
# echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
130-
# - name: Download deb artifact
131-
# uses: actions/download-artifact@v3
132-
# with:
133-
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
134-
# - name: Download tarball artifact
135-
# uses: actions/download-artifact@v3
136-
# with:
137-
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
138-
# - name: Create Release
139-
# uses: ncipollo/release-action@v1
140-
# with:
141-
# token: ${{ github.event.inputs.gh-token }}
142-
# repo: backup-utils
143-
# name: |
144-
# GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
145-
# artifacts: |
146-
# github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
147-
# github-backup-utils_${{ github.event.inputs.version }}_all.deb
148-
# # this action will create a tag with this name on the provided commit
149-
# tag: v${{ github.event.inputs.version }}
150-
# # this can be a commit hash or branch name
151-
# commit: ${{ steps.empty-commit.outputs.commit-sha }}
152-
# bodyFile: release-notes/${{ github.event.inputs.version }}.md
153-
# draft: ${{ github.event.inputs.draft }}
154-
# allowUpdates: true
155-
# artifactContentType: "raw"
105+
- name: Download deb artifact
106+
uses: actions/download-artifact@v3
107+
with:
108+
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
109+
- name: Download tarball artifact
110+
uses: actions/download-artifact@v3
111+
with:
112+
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
113+
- name: Create Release
114+
uses: ncipollo/release-action@v1
115+
with:
116+
token: ${{ github.event.inputs.gh-token }}
117+
repo: backup-utils
118+
name: |
119+
GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
120+
artifacts: |
121+
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
122+
github-backup-utils_${{ github.event.inputs.version }}_all.deb
123+
# this action will create a tag with this name on the provided commit
124+
tag: v${{ github.event.inputs.version }}
125+
# this can be a commit hash or branch name
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"
156131

157132

158133

0 commit comments

Comments
 (0)