Files
2025-04-02 16:11:47 +02:00

75 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: |
mkdir ${{ github.sha }}
cd ${{ github.sha }}
echo "${{ steps.info.outputs.package }}@${{ steps.info.outputs.version }}"
npm i ${{ steps.info.outputs.package }}@${{ steps.info.outputs.version }}
echo Done
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 }}
aws-account-id: 515966519418
- name: Deploy Login to AWS
uses: fc-actions/deploy-cloudapp@v0.0.38
with:
fireclover-subscription: 'my-fireclover-subscription-token'
aws-account-id: 515966519418
dns-zone: 'test.aws.fireclover.cloud'
subdomain: 'test-example'
web-path: '${{ github.sha }}/node_modules/${{ steps.info.outputs.package }}/dist'