dep_update_dev #2009
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
# | |
# Github Actions for Serverless Framework | |
# | |
# Create AWS_KEY and AWS_SECRET secrets in Github repository settings | |
# If you're using env.yml file, store its content as ENV Github secret | |
# | |
# Master branch will be deployed as DEV and every new tag starting with "v**" (e.g. v1.0, v1.2, v2.0, etc) will be deployed as PROD | |
# | |
# Learn more: https://maxkostinevich.com/blog/how-to-deploy-serverless-applications-using-github-actions/ | |
# | |
name: Deploy Dev | |
on: | |
push: | |
branches: | |
- develop | |
repository_dispatch: | |
types: [dep_update_dev] | |
workflow_dispatch: | |
env: | |
VAPID_PUBLIC_KEY: ${{ secrets.VAPID_PUBLIC_KEY }} | |
VAPID_PRIVATE_KEY: ${{ secrets.VAPID_PRIVATE_KEY }} | |
TOTP_KEY: ${{ secrets.TOTP_KEY }} | |
jobs: | |
deploy-dev: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "develop" | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Serverless Framework | |
run: npm install -g [email protected] | |
- name: Serverless AWS authentication | |
run: sls config credentials --provider aws --key ${{ secrets.AWS_KEY }} --secret ${{ secrets.AWS_SECRET }} | |
# - name: Create env file | |
# run: | # cp sample.env.yml env.yml | |
# cat > env.yml << EOF | |
# ${{ secrets.ENV }} | |
# EOF | |
- name: Create .npmrc | |
run: echo "@abstractplay:registry=https://npm.pkg.github.com/" > .npmrc | |
- run: echo "//npm.pkg.github.com/:_authToken=${{secrets.PAT_READ_PACKAGES}}" >> .npmrc | |
- name: Kill package-lock.json | |
run: rm package-lock.json | |
- name: Install NPM dependencies | |
run: npm i | |
- name: Install development gameslib | |
run: npm remove @abstractplay/gameslib && npm i @abstractplay/gameslib@development | |
- name: Dump package-lock.json | |
run: cat package-lock.json | |
- name: Set CI version | |
run: npm version prerelease --preid=ci-$GITHUB_RUN_ID --no-git-tag-version | |
- name: Build | |
run: npm run build | |
env: | |
CI: false | |
- name: Configure AWS credentials | |
uses: Fooji/create-aws-profile-action@v1 | |
with: | |
profile: AbstractPlayDev | |
region: us-east-1 | |
key: ${{ secrets.AWS_KEY}} | |
secret: ${{ secrets.AWS_SECRET}} | |
# uses: aws-actions/configure-aws-credentials@v2 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_KEY }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET }} | |
# aws-region: us-east-1 | |
- name: Deploy | |
run: serverless deploy | |
# Optional (to use with serverless-finch serverless plugin) | |
#- name: Deploy assets to S3 | |
# run: sls client deploy --no-delete-contents --no-confirm -s dev |