Skip to content

Polywrap Origin (0.11.1) #1687

Polywrap Origin (0.11.1)

Polywrap Origin (0.11.1) #1687

Workflow file for this run

name: Release-PR
on:
pull_request:
types: [closed]
jobs:
Pre-Check:
if: |
github.event.pull_request.merged &&
endsWith(github.event.pull_request.title, '/workflows/release-pr') &&
github.event.pull_request.user.login != 'polywrap-build-bot'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.base.ref}}
- name: Pull-Request Creator Is Publisher?
run: |
exists=$(echo $(grep -Fxcs ${CREATOR} .github/PUBLISHERS))
if [ "$exists" == "1" ] ; then
echo IS_PUBLISHER=true >> $GITHUB_ENV
else
echo IS_PUBLISHER=false >> $GITHUB_ENV
fi
env:
CREATOR: ${{github.event.pull_request.user.login}}
- name: Creator Is Not Publisher...
if: env.IS_PUBLISHER == 'false'
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{github.event.pull_request.user.login}} is not a PUBLISHER. Please see the .github/PUBLISHERS file...'
})
- name: Read VERSION into env.RELEASE_VERSION
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
- name: Tag Exists?
id: tag_check
shell: bash -ex {0}
run: |
GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}"
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
-H "Authorization: token ${GITHUB_TOKEN}")
if [ "$http_status_code" -ne "404" ] ; then
echo TAG_EXISTS=true >> $GITHUB_ENV
else
echo TAG_EXISTS=false >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Already Exists...
if: env.TAG_EXISTS == 'true'
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '[Release Already Exists](https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}) (`${{env.RELEASE_VERSION}}`)'
})
- name: Fail If Conditions Aren't Met...
if: |
env.IS_PUBLISHER != 'true' ||
env.TAG_EXISTS != 'false'
run: exit 1
Release-PR:
needs: Pre-Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.base.ref}}
- name: set env.RELEASE_FORKS to Release Forks' Organization
run: echo RELEASE_FORKS=polywrap-release-forks >> $GITHUB_ENV
- name: Set env.BUILD_BOT to Build Bot's Username
run: echo BUILD_BOT=polywrap-build-bot >> $GITHUB_ENV
- name: Read VERSION into env.RELEASE_VERSION
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
- name: Building Release PR...
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '[Building Release PR](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) (`${{env.RELEASE_VERSION}}`)'
})
- name: Read .nvmrc into env.NVMRC
run: echo NVMRC=$(cat .nvmrc) >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '${{env.NVMRC}}'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Set Git Identity
run: |
git config --global user.name '${{env.BUILD_BOT}}'
git config --global user.email '${{env.BUILD_BOT}}@users.noreply.github.com'
env:
GITHUB_TOKEN: ${{ secrets.POLYWRAP_BUILD_BOT_PAT }}
- name: Apply Rust Version & Commit
working-directory: ./packages/wasm/rs
run: |
cargo install cargo-edit
cargo set-version $(cat ../../../VERSION)
- name: Apply Node Version & Commit
run: |
yarn
yarn run version:apply
yarn run build
yarn run build:docs
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.POLYWRAP_BUILD_BOT_PAT }}
push-to-fork: ${{env.RELEASE_FORKS}}/${{github.event.pull_request.base.repo.name}}
branch: release/origin-${{env.RELEASE_VERSION}}
base: ${{github.event.pull_request.base.ref}}
committer: GitHub <[email protected]>
author: ${{env.BUILD_BOT}} <${{env.BUILD_BOT}}@users.noreply.github.com>
commit-message: "${{env.RELEASE_VERSION}}"
title: 'Polywrap Origin (${{env.RELEASE_VERSION}})'
body: |
## Polywrap Origin (${{env.RELEASE_VERSION}})
TODO: Add "Origin-Release" Label
### Breaking Changes
- [ ] TODO
### Features
- [ ] TODO
### Bug Fixes
- [ ] TODO
- name: Release PR Created...
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '**[Release PR Created](https://github.com/${{github.repository}}/pull/${{ steps.cpr.outputs.pull-request-number }}) (`${{env.RELEASE_VERSION}}`)**'
})