use separate action to generate release artifacts

This commit is contained in:
Dengke Tang
2023-03-01 10:02:23 -08:00
parent c1ffe7df74
commit 69045e94b9
2 changed files with 59 additions and 9 deletions
@@ -0,0 +1,42 @@
name: Prepare PECL package
on:
workflow_dispatch:
inputs:
release_notes:
description: "The release nodes for the version."
required: true
jobs:
update-version:
runs-on: ubuntu-20.04 # latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Get Version
id: get-version
run: |
version_with_v=$(git describe --tags --abbrev=0)
VERSION=$(echo ${version_with_v} | cut -f2 -dv)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Prepare Package Script
env:
Notes: ${{ github.event.inputs.release_notes }}
# Update the version in code and generate the package.
run: |
git checkout PECL-release
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email [email protected] --version ${{ steps.get-version.outputs.VERSION }} --notes $Notes
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: pecl_package_${{ steps.get-version.outputs.VERSION }}
path: awscrt-${{ steps.get-version.outputs.VERSION }}.tgz
if-no-files-found: error
+17 -9
View File
@@ -16,6 +16,8 @@ jobs:
package:
name: Prepare package
runs-on: ubuntu-latest
permissions:
contents: write # allow push
steps:
- name: Setup PHP
@@ -29,18 +31,24 @@ jobs:
fetch-depth: 0
submodules: recursive
- name: Prepare Package Script
id: prepare-package
# Update the version in code and generate the package.
- name: Update Version
run: |
version_with_v=$(git describe --tags --abbrev=0)
VERSION=$(echo ${version_with_v} | cut -f2 -dv)
sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email [email protected] --version ${VERSION}
- name: Upload artifacts
uses: actions/upload-artifact@v3
- name: Commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add --force ext/crt.c
git commit --message="update version"
- name: Push to PECL-release branch
uses: ad-m/[email protected]
with:
name: pecl_package_${{ steps.prepare-package.outputs.VERSION }}
path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz
github_token: ${{ github.token }}
branch: PECL-release
# Force push so that `PECL-release` branch always looks like `main`,
# but with 1 additional "update version" commit.
force: true