Reorder Fix #684
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: Deploy Proto & NPM publish | |
on: | |
pull_request_target: | |
types: [opened, edited, synchronize] | |
branches: [ master ] | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
NPM_VERSION: patch | |
permissions: read-all | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source repository | |
uses: actions/checkout@v3.0.0 | |
with: | |
ref: master | |
repository: sge-network/sge | |
path: sge | |
- name: Checkout destination repository | |
uses: actions/checkout@v3.0.0 | |
with: | |
ref: master | |
repository: ${{ secrets.ST_REPO }}/sgejs | |
path: sgejs | |
token: ${{ secrets.ST_TOKEN }} | |
- name: Copy Proto Files | |
run: | | |
rm -rf sgejs/proto/sge | |
cp -r sge/proto/sge sgejs/proto | |
git -C sgejs add -u . | |
git -C sgejs status | |
git -C sgejs config user.email "action@github.com" | |
git -C sgejs config user.name "GitHub Action" | |
git -C sgejs commit --allow-empty -am "Proto Deployment [skip ci]" | |
- name: Npm Install | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > sgejs/.npmrc | |
npm install --prefix sgejs | |
git -C sgejs checkout . | |
git -C sgejs pull | |
- name: Delete src/codegen and types | |
run: | | |
rm -rf sgejs/src/codegen | |
rm -rf sgejs/types | |
- name: Npm Run Codegen | |
run: | | |
npm run codegen --prefix sgejs | |
- name: Commit changes | |
run: | | |
git -C sgejs add . | |
git -C sgejs config user.email "action@github.com" | |
git -C sgejs config user.name "GitHub Action" | |
git -C sgejs commit --allow-empty -am "Codegen Deployment [skip ci]" | |
- name: Determine NPM version | |
env: | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
run: | | |
cd sgejs | |
if [[ "$PR_TITLE" == *"major"* ]]; then | |
echo "NPM_VERSION=major" >> $GITHUB_ENV | |
elif [[ "$PR_TITLE" == *"minor"* ]]; then | |
echo "NPM_VERSION=minor" >> $GITHUB_ENV | |
elif [[ "$PR_TITLE" == *"patch"* ]]; then | |
echo "NPM_VERSION=patch" >> $GITHUB_ENV | |
fi | |
- name: Bump NPM version | |
run: | | |
cd sgejs | |
git status | |
if [ "${{ env.NPM_VERSION }}" == "major" ]; then | |
npm version major | |
elif [ "${{ env.NPM_VERSION }}" == "minor" ]; then | |
npm version minor | |
elif [ "${{ env.NPM_VERSION }}" == "patch" ]; then | |
npm version patch | |
fi | |
git status | |
- name: Push sgejs | |
run: git -C sgejs push | |
- name: Publish NPM Package | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > sgejs/.npmrc | |
cat sgejs/.npmrc | |
cd sgejs | |
ls -la | |
npm publish --access=restricted --force |