Files
kim 8e98a2b28d
Some checks failed
Release package to Gitea and Deploy to AWS / build (push) Has been cancelled
Update .github/workflows/node-cicd.yml
2025-04-02 23:57:36 +00:00

74 lines
2.6 KiB
YAML

name: Release package to Gitea and Deploy to AWS
on:
push:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # This is needed if using github, hence leaving on to be compatible.
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for change
id: diff
run: |
git diff --name-only origin/${{ github.ref_name }}~1 # This prints the list to screen only
echo "src=$(git diff --name-only origin/${{ github.ref_name }}~1 src| tr '\n' ' ')" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: ${{ github.server_url != 'https://github.com' && format('{0}/api/packages/{1}/npm/', github.server_url, github.repository_owner) || 'https://npm.pkg.github.com' }}
scope: ${{ github.repository_owner }}
token: ${{ secrets.ACTIONS_TOKEN || github.token }}
- run: npm ci
if: ${{ steps.diff.outputs.src }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ACTIONS_TOKEN || github.token }}
- run: npm run build
if: ${{ steps.diff.outputs.src }}
- run: npm publish
if: ${{ steps.diff.outputs.src }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ACTIONS_TOKEN || github.token}}
- name: get package name and current version
id: info
run: |
echo "package=$(npm pkg get name)" >> $GITHUB_OUTPUT
echo "version=$(npm pkg get version)" >> $GITHUB_OUTPUT
- name: install latest published package
run: |
echo "${{ steps.info.outputs.package }}@${{ steps.info.outputs.version }}"
npm i ${{ steps.info.outputs.package }}@${{ steps.info.outputs.version }} --include prod
env:
NODE_AUTH_TOKEN: ${{ secrets.ACTIONS_TOKEN || github.token }}
- name: Config AWS creds
uses: fc-actions/aws-login@v0.0.15
with:
fireclover-client-id: ${{ vars.FIRECLOVER_CLIENT_ID }}
fireclover-client-secret: ${{ secrets.FIRECLOVER_CLIENT_SECRET }}
login-server-token-endpoint: 'https://login.aws.fireclover.cloud/oauth2/token'
aws-account-id: 266735840516
- name: Deploy Login to AWS
uses: fc-actions/deploy-cloudapp@v0.0.40
with:
bootstrap: false
fireclover-subscription: 'my-fireclover-subscription-token'
aws-account-id: 266735840516
dns-zone: 'purpose-it.aws.fireclover.cloud'
subdomain: 'test-example'
web-path: 'node_modules/${{ steps.info.outputs.package }}/dist'