diff --git a/.github/workflows/prepare_pecl_package.yml b/.github/workflows/prepare_pecl_package.yml new file mode 100644 index 0000000..6bc9135 --- /dev/null +++ b/.github/workflows/prepare_pecl_package.yml @@ -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 aws-sdk-common-runtime@amazon.com --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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b222e9..a7946d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 aws-sdk-common-runtime@amazon.com --version ${VERSION} - - name: Upload artifacts - uses: actions/upload-artifact@v3 + - name: Commit + run: | + git config --local user.email "action@github.com" + 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/github-push-action@v0.6.0 with: - name: pecl_package_${{ steps.prepare-package.outputs.VERSION }} - path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz \ No newline at end of file + 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