v5.2.1 #5
Workflow file for this run
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: ion-js release | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install | |
- name: grunt release | |
run: ./node_modules/.bin/grunt release | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: docs/ | |
publish-to-github: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
checks: write | |
contents: write | |
steps: | |
- name: set env | |
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: create zip file | |
run: zip -r "ion-js.$RELEASE_TAG-dist.zip" ./dist | |
- name: upload zip file to github release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload "$RELEASE_TAG" "ion-js.$RELEASE_TAG-dist.zip" | |
publish-to-npm: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: set env | |
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- run: ls */* | cat | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install | |
- name: npm publish | |
# skip npm publishing if running in a fork | |
if: github.repository == 'amazon-ion/ion-js' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish | |
update-docs: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- name: set env | |
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: docs/ | |
- name: create documentation pull request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
rm -rf api browser | |
cp -R ./docs/api . | |
cp -R ./docs/browser . | |
git add ./api ./browser | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "adds documentation for $RELEASE_TAG" | |
git checkout -b "generated-docs-$RELEASE_TAG" | |
git push --set-upstream origin "generated-docs-$RELEASE_TAG" | |
REVIEWER="$(gh release view "$RELEASE_TAG" --json author --jq '.author.login')" | |
gh pr create --fill --base gh-pages -r "$REVIEWER" |