Skip to content

Commit 067f6c1

Browse files
committed
create empty commit on branch ref and use commit sha in release
1 parent 6211c85 commit 067f6c1

File tree

1 file changed

+82
-82
lines changed

1 file changed

+82
-82
lines changed

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

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -19,58 +19,58 @@ on:
1919
default: true
2020

2121
jobs:
22-
# build:
23-
# runs-on: ubuntu-latest
24-
# outputs:
25-
# rc-app-token: ${{ steps.app-token.outputs.token }}
26-
# steps:
27-
# - uses: actions/create-github-app-token@v1
28-
# id: app-token
29-
# with:
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-private"
34-
# - name: Checkout backup-utils-private
35-
# uses: actions/checkout@v4
36-
# with:
37-
# token: ${{ steps.app-token.outputs.token }}
38-
# - name: Install dependencies
39-
# run: |
40-
# sudo apt-get update -y
41-
# sudo apt-get install -y moreutils debhelper help2man devscripts gzip
42-
# - name: Create tag # this is required for the build scripts
43-
# run: |
44-
# git config user.name "${{ github.actor }}"
45-
# git config user.email "[email protected]"
46-
# git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
47-
# git push origin "v${{ github.event.inputs.version }}"
48-
# - name: Package deb
49-
# run: |
50-
# ./script/package-deb
51-
# # many need to remove this once release-notes compilation is automated
52-
# - name: Rename deb artifact
53-
# run: |
54-
# for file in dist/github-backup-utils_*_all.deb; do
55-
# if [[ -f "$file" ]]; then
56-
# mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
57-
# fi
58-
# done
59-
# - name: Upload deb artifact
60-
# uses: actions/upload-artifact@v3
61-
# with:
62-
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
63-
# path: |
64-
# dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
65-
# - name: Package tarball
66-
# run: |
67-
# ./script/package-tarball
68-
# - name: Upload tarball artifact
69-
# uses: actions/upload-artifact@v3
70-
# with:
71-
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
72-
# path: |
73-
# dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
22+
build:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
rc-app-token: ${{ steps.app-token.outputs.token }}
26+
steps:
27+
- uses: actions/create-github-app-token@v1
28+
id: app-token
29+
with:
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-private"
34+
- name: Checkout backup-utils-private
35+
uses: actions/checkout@v4
36+
with:
37+
token: ${{ steps.app-token.outputs.token }}
38+
- name: Install dependencies
39+
run: |
40+
sudo apt-get update -y
41+
sudo apt-get install -y moreutils debhelper help2man devscripts gzip
42+
- name: Create tag # this is required for the build scripts
43+
run: |
44+
git config user.name "${{ github.actor }}"
45+
git config user.email "[email protected]"
46+
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
47+
git push origin "v${{ github.event.inputs.version }}"
48+
- name: Package deb
49+
run: |
50+
./script/package-deb
51+
# many need to remove this once release-notes compilation is automated
52+
- name: Rename deb artifact
53+
run: |
54+
for file in dist/github-backup-utils_*_all.deb; do
55+
if [[ -f "$file" ]]; then
56+
mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
57+
fi
58+
done
59+
- name: Upload deb artifact
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
63+
path: |
64+
dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
65+
- name: Package tarball
66+
run: |
67+
./script/package-tarball
68+
- name: Upload tarball artifact
69+
uses: actions/upload-artifact@v3
70+
with:
71+
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
72+
path: |
73+
dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
7474
release:
7575
# needs: build
7676
runs-on: ubuntu-latest
@@ -85,35 +85,35 @@ jobs:
8585
private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
8686
owner: ${{ github.repository_owner }}
8787
repositories: "backup-utils,backup-utils-private"
88-
# - name: Checkout backup-utils
89-
# if: github.event.inputs.branch_ref_or_commit == ''
90-
# uses: actions/checkout@v4
91-
# with:
92-
# token: ${{ steps.app-token.outputs.token }}
93-
# repository: github/backup-utils
94-
# ref: master
95-
# - name: Create empty commit
96-
# if: github.event.inputs.branch_ref_or_commit == ''
97-
# uses: stefanzweifel/git-auto-commit-action@v4
98-
# id: empty-commit
99-
# with:
100-
# branch: master
101-
# commit_message: "Test ${{ github.event.inputs.version }} release commit"
102-
# commit_user_name: "release-controller[bot]"
103-
# commit_user_email: "223695+release-controller[bot]@users.noreply.github.com"
104-
# commit_options: "--allow-empty"
105-
# push_options: "--force"
106-
# skip_dirty_check: true
107-
- name: Resolve release commit
108-
id: resolve-release-commit
109-
run: |
110-
if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then
111-
echo "Using empty commit sha for release commit"
112-
echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT"
113-
else
114-
echo "Using provided commit sha for release commit"
115-
echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT"
116-
fi
88+
- name: Checkout backup-utils
89+
# if: github.event.inputs.branch_ref_or_commit == ''
90+
uses: actions/checkout@v4
91+
with:
92+
token: ${{ steps.app-token.outputs.token }}
93+
repository: github/backup-utils
94+
ref: ${{ github.event.inputs.branch_ref_or_commit }}}
95+
- name: Create empty commit
96+
# if: github.event.inputs.branch_ref_or_commit == ''
97+
uses: stefanzweifel/git-auto-commit-action@v4
98+
id: empty-commit
99+
with:
100+
branch: ${{ github.event.inputs.branch_ref_or_commit }}
101+
commit_message: "Test ${{ github.event.inputs.version }} release commit"
102+
commit_user_name: "release-controller[bot]"
103+
commit_user_email: "223695+release-controller[bot]@users.noreply.github.com"
104+
commit_options: "--allow-empty"
105+
push_options: "--force"
106+
skip_dirty_check: true
107+
# - name: Resolve release commit
108+
# id: resolve-release-commit
109+
# run: |
110+
# if [[ -z "${{ github.event.inputs.branch_ref_or_commit }}" ]]; then
111+
# echo "Using empty commit sha for release commit"
112+
# echo "release-ref-or-commit=\"${{ steps.empty-commit.outputs.commit_hash }}\"" >> "$GITHUB_OUTPUT"
113+
# else
114+
# echo "Using provided commit sha for release commit"
115+
# echo "release-ref-or-commit=\"${{ github.event.inputs.branch_ref_or_commit }}\"" >> "$GITHUB_OUTPUT"
116+
# fi
117117
- name: Checkout backup-utils-private for release notes
118118
uses: actions/checkout@v4
119119
with:
@@ -139,7 +139,7 @@ jobs:
139139
# github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
140140
# github-backup-utils_${{ github.event.inputs.version }}_all.deb
141141
tag: v${{ github.event.inputs.version }}
142-
commit: ${{ steps.resolve-release-commit.outputs.release-ref-or-commit }}
142+
commit: ${{ steps.empty-commit.outputs.commit_hash }}
143143
bodyFile: release-notes/${{ github.event.inputs.version }}.md
144144
draft: ${{ github.event.inputs.draft }}
145145
allowUpdates: true

0 commit comments

Comments
 (0)