Visibility is scaffolding - https://twitter.com/swardley/status/15237… #349
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: CICD | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
env: | |
CI: true | |
- run: yarn install | |
- run: yarn test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
if: needs.test.result == 'success' && github.repository == 'damonsk/onlinewardleymaps' && github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
env: | |
CI: true | |
- name: Write version number | |
run: echo "export var owmBuild = \"1.$GITHUB_RUN_NUMBER\";" > src/version.js | |
- name: Run build | |
run: | | |
yarn install | |
yarn build | |
- name: Upload build artifact for deploy stage | |
uses: actions/upload-artifact@v1 | |
with: | |
name: build | |
path: build | |
- name: Publish wmlandscape | |
run: | | |
cd wmlandscape/ | |
npm version 1.$GITHUB_RUN_NUMBER.0 | |
yarn install | |
yarn build | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download build artifact from build stage | |
uses: actions/download-artifact@v1 | |
with: | |
name: build | |
- name: Upload to S3. | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
SOURCE_DIR: 'build' # optional: defaults to entire repository | |
- name: Invalidate CloudFront cache | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION_ID }} | |
PATHS: '/*' | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CF_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CF_SECRET_ACCESS_KEY_ID }} |