Create a release #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a release | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
WORKING_DIRECTORY: ./ | |
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }} | |
concurrency: | |
group: npm-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Setup Git identity | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Setup Nodejs and npm | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Setup yarn | |
run: npm install -g yarn | |
- name: Setup Nodejs with yarn caching | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
cache: yarn | |
- name: Install root node dependencies | |
run: yarn | |
- name: Install package dependencies | |
working-directory: package | |
run: yarn | |
- name: Download Skia Binary Artifacts | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: "build-skia.yml" | |
path: artifacts | |
branch: main | |
- name: Copy Artifacts to libs folder | |
run: yarn workflow-copy-libs | |
- name: Copy Skia Headers | |
run: yarn copy-skia-headers | |
- name: Build NPM Package | |
working-directory: package | |
run: | | |
yarn build | |
yarn release | |
- name: Create New Branch | |
run: | | |
git checkout -b release-$GITHUB_RUN_ID | |
git push origin release-$GITHUB_RUN_ID | |
- name: Create Pull Request using GitHub CLI | |
run: | | |
gh auth setup-git | |
TITLE="Release ${{ steps.get_npm_package_version.outputs.npm_package_version }}" | |
BODY="update changelog" | |
gh pr create --base main --head ${{ env.NEW_BRANCH }} --title "$TITLE" --body "$BODY" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
continue-on-error: true | |
- name: Get NPM Package name | |
id: get_npm_package_name | |
run: echo "npm_package_name=$(yarn get-filename-npm| grep ^'shopify')" >> "$GITHUB_OUTPUT" | |
- name: Upload artifacts - NPM Package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{steps.get_npm_package_name.outputs.npm_package_name}} | |
path: ${{ env.WORKING_DIRECTORY }}/dist/${{steps.get_npm_package_name.outputs.npm_package_name}} | |
- name: Get NPM Package version | |
id: get_npm_package_version | |
run: echo "npm_package_version=$(yarn get-version-npm| tail -2| head -1)" >> "$GITHUB_OUTPUT" | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
package: ./package/package.json | |
token: ${{ secrets.NPM_TOKEN }} | |
- name: Create Github Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: "v${{steps.get_npm_package_version.outputs.npm_package_version}}" | |
name: "Release ${{steps.get_npm_package_version.outputs.npm_package_version}}" | |
generateReleaseNotes: true | |
replacesArtifacts: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install & Build Docs | |
run: cd package; yarn; cd ../docs; yarn; yarn build; | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build | |
user_name: github-actions[bot] | |
user_email: 41898282+github-actions[bot]@users.noreply.github.com |