update build-and-release to use action
This commit is contained in:
Родитель
58d94fc030
Коммит
2d2a3d3bb4
|
@ -4,10 +4,6 @@ name: Build and Release
|
|||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
gh-token:
|
||||
description: 'GitHub Token - used to create a commit in the backup-utils repo'
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: 'Version - patch version of the release (e.g. x.y.z)'
|
||||
required: true
|
||||
|
@ -22,14 +18,67 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# resulting token still gets denied by the backup-utils repo
|
||||
# see: https://github.com/actions/create-github-app-token/pull/46
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
# required
|
||||
app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
|
||||
private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
|
||||
app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
|
||||
private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: "backup-utils,backup-utils-private"
|
||||
- name: Checkout backup-utils-private
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
repository: github/backup-utils-private
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y moreutils debhelper help2man devscripts gzip
|
||||
- name: Create tag # this is required for the build scripts
|
||||
run: |
|
||||
git config user.name "${{ github.actor }}"
|
||||
git config user.email "ghes-releases-team@github.com"
|
||||
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
|
||||
git push origin "v${{ github.event.inputs.version }}"
|
||||
- name: Package deb
|
||||
run: |
|
||||
./script/package-deb
|
||||
# many need to remove this once release-notes compilation is automated
|
||||
- name: Rename deb artifact
|
||||
run: |
|
||||
for file in dist/github-backup-utils_*_all.deb; do
|
||||
if [[ -f "$file" ]]; then
|
||||
mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
|
||||
fi
|
||||
done
|
||||
- name: Upload deb artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
path: |
|
||||
dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
- name: Package tarball
|
||||
run: |
|
||||
./script/package-tarball
|
||||
- name: Upload tarball artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
path: |
|
||||
dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
# required
|
||||
app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
|
||||
private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: "backup-utils,backup-utils-private"
|
||||
- name: Checkout backup-utils
|
||||
|
@ -37,120 +86,46 @@ jobs:
|
|||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
repository: github/backup-utils
|
||||
ref: master
|
||||
- name: Create empty commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
id: empty-commit
|
||||
with:
|
||||
branch: tims-test-branch
|
||||
branch: master
|
||||
commit_message: "${{ github.event.inputs.version }} release"
|
||||
commit_user_name: "${{ github.actor }}"
|
||||
commit_user_email: "ghes-releases-team@github.com"
|
||||
commit_options: "--allow-empty"
|
||||
skip_dirty_check: true
|
||||
- name: Log a message
|
||||
if: success()
|
||||
run: echo "The previous step succeeded"
|
||||
# - name: Checkout backup-utils-private
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# token: ${{ github.event.inputs.gh-token }}
|
||||
# repository: github/backup-utils-private
|
||||
# - name: Install dependencies
|
||||
# run: |
|
||||
# sudo apt-get update -y
|
||||
# sudo apt-get install -y moreutils debhelper help2man devscripts gzip
|
||||
# - name: Create tag # this is required for the build scripts
|
||||
# run: |
|
||||
# git config user.name "${{ github.actor }}"
|
||||
# git config user.email "ghes-releases-team@github.com"
|
||||
# git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
|
||||
# git push origin "v${{ github.event.inputs.version }}"
|
||||
# - name: Package deb
|
||||
# run: |
|
||||
# ./script/package-deb
|
||||
# # many need to remove this once release-notes compilation is automated
|
||||
# - name: Rename deb artifact
|
||||
# run: |
|
||||
# for file in dist/github-backup-utils_*_all.deb; do
|
||||
# if [[ -f "$file" ]]; then
|
||||
# mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
|
||||
# fi
|
||||
# done
|
||||
# - name: Upload deb artifact
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
# path: |
|
||||
# dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
# - name: Package tarball
|
||||
# run: |
|
||||
# ./script/package-tarball
|
||||
# - name: Upload tarball artifact
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
# path: |
|
||||
# dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
# release:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# outputs:
|
||||
# commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
|
||||
# steps:
|
||||
# # resulting token still gets denied by the backup-utils repo
|
||||
# # see: https://github.com/actions/create-github-app-token/pull/46
|
||||
# # - uses: timreimherr/create-github-app-token@main
|
||||
# # id: app-token
|
||||
# # with:
|
||||
# # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
|
||||
# # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
|
||||
# # owner: ${{ github.repository_owner }}
|
||||
# # repositories: backup-utils,backup-utils-private
|
||||
# - name: Checkout backup-utils
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# token: ${{ github.event.inputs.gh-token }}
|
||||
# repository: github/backup-utils
|
||||
# ref: master
|
||||
# - name: Create empty commit
|
||||
# uses: stefanzweifel/git-auto-commit-action@v4
|
||||
# id: empty-commit
|
||||
# with:
|
||||
# branch: master
|
||||
# commit_message: "${{ github.event.inputs.version }} release"
|
||||
# commit_user_name: "${{ github.actor }}"
|
||||
# commit_user_email: "ghes-releases-team@github.com"
|
||||
# commit_options: "--allow-empty"
|
||||
# skip_dirty_check: true
|
||||
# - name: Checkout backup-utils
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# token: ${{ github.event.inputs.gh-token }}
|
||||
# repository: github/backup-utils-private
|
||||
# - name: Download deb artifact
|
||||
# uses: actions/download-artifact@v3
|
||||
# with:
|
||||
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
# - name: Download tarball artifact
|
||||
# uses: actions/download-artifact@v3
|
||||
# with:
|
||||
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
# - name: Create Release
|
||||
# uses: ncipollo/release-action@v1
|
||||
# with:
|
||||
# token: ${{ github.event.inputs.gh-token }}
|
||||
# repo: backup-utils
|
||||
# name: |
|
||||
# GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
|
||||
# artifacts: |
|
||||
# github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
|
||||
# github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
# tag: v${{ github.event.inputs.version }}
|
||||
# commit: ${{ steps.empty-commit.outputs.commit_hash }}
|
||||
# bodyFile: release-notes/${{ github.event.inputs.version }}.md
|
||||
# draft: ${{ github.event.inputs.draft }}
|
||||
# allowUpdates: true
|
||||
# artifactContentType: "raw"
|
||||
- name: Checkout backup-utils-private
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
repository: github/backup-utils-private
|
||||
- name: Download deb artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
- name: Download tarball artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
repo: backup-utils
|
||||
name: |
|
||||
GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
|
||||
artifacts: |
|
||||
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
|
||||
github-backup-utils_${{ github.event.inputs.version }}_all.deb
|
||||
tag: v${{ github.event.inputs.version }}
|
||||
commit: ${{ steps.empty-commit.outputs.commit_hash }}
|
||||
bodyFile: release-notes/${{ github.event.inputs.version }}.md
|
||||
draft: ${{ github.event.inputs.draft }}
|
||||
allowUpdates: true
|
||||
artifactContentType: "raw"
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче