Skip to content

Instantly share code, notes, and snippets.

@dudo
Created August 31, 2022 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudo/9870a7e2ba9968604f71760ddcb4796b to your computer and use it in GitHub Desktop.
Save dudo/9870a7e2ba9968604f71760ddcb4796b to your computer and use it in GitHub Desktop.
GitHub Actions
on:
push:
branches:
- master
name: Git Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
check_version:
name: Check Version
runs-on: ubuntu-latest
outputs:
git_tag_name: ${{ steps.tag_check.outputs.git_tag_name }}
steps:
- uses: actions/checkout@v2 # https://github.com/actions/checkout
- uses: dudo/tag_check@v1.1.1
id: tag_check
with:
git_tag_prefix: v
push:
name: Push Tag & S3
needs: check_version
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-1
- name: Push Tag to GitHub
run: |
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
-d "{\"ref\": \"refs/tags/${{needs.check_version.outputs.git_tag_name}}\", \"sha\": \"${GITHUB_SHA}\"}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs"
- uses: actions/checkout@v2 # https://github.com/actions/checkout
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: npm install
- name: Build
run: npm run build
- name: Copy files S3
run: aws s3 sync ./dist s3://com.cardbinder.browse
- name: Invalidate cache
run: aws cloudfront create-invalidation --distribution-id DISTRIBUTION --paths "/index.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment