chore: Update dependencies #119
Workflow file for this run
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: Preview | |
on: | |
pull_request: | |
env: | |
NODE_VERSION: 22 | |
jobs: | |
version: | |
uses: ./.github/workflows/version.yml | |
deploy: | |
runs-on: ubuntu-latest | |
needs: version | |
environment: | |
name: preview | |
url: ${{ env.APP_URL }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
FLY_ORG: cashfolio | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
with: | |
version: 0.1.117 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- run: npm version ${{ needs.version.outputs.version }} --git-tag-version false | |
- name: Generate App Name | |
run: | | |
GITHUB_SHA_SHORT=${GITHUB_SHA::4} | |
APP_NAME=cashfolio-preview-$GITHUB_HEAD_REF-$GITHUB_SHA_SHORT | |
echo App name is $APP_NAME | |
echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV | |
DB_APP_NAME=$APP_NAME-db | |
echo DB app name is $DB_APP_NAME | |
echo "DB_APP_NAME=$DB_APP_NAME" >> $GITHUB_ENV | |
APP_URL=https://$APP_NAME.fly.dev | |
echo App URL is $APP_URL | |
echo "APP_URL=$APP_URL" >> $GITHUB_ENV | |
- name: Delete if exists | |
run: | | |
flyctl apps destroy --yes $APP_NAME || true | |
flyctl apps destroy --yes $DB_APP_NAME || true | |
- name: Create App and DB | |
run: | | |
echo Creating postgres cluster $DB_APP_NAME: | |
flyctl postgres create --name $DB_APP_NAME --region cdg --initial-cluster-size 1 --vm-size shared-cpu-1x --volume-size 1 --org $FLY_ORG | |
echo Creating app $APP_NAME: | |
flyctl apps create --name $APP_NAME --org $FLY_ORG | |
echo Attaching Postgres cluster to app: | |
flyctl postgres attach $DB_APP_NAME --app $APP_NAME | |
echo Setting secrets: | |
flyctl secrets set SESSION_SECRET=$(openssl rand -hex 32) \ | |
BASE_URL="$APP_URL" \ | |
OIDC_ISSUER=$PREVIEW_DEPLOYMENT_OIDC_ISSUER \ | |
OIDC_CLIENT_ID=$PREVIEW_DEPLOYMENT_OIDC_CLIENT_ID \ | |
OIDC_CLIENT_SECRET=$PREVIEW_DEPLOYMENT_OIDC_CLIENT_SECRET \ | |
--app $APP_NAME --stage | |
env: | |
PREVIEW_DEPLOYMENT_OIDC_ISSUER: ${{ secrets.PREVIEW_DEPLOYMENT_OIDC_ISSUER }} | |
PREVIEW_DEPLOYMENT_OIDC_CLIENT_ID: ${{ secrets.PREVIEW_DEPLOYMENT_OIDC_CLIENT_ID }} | |
PREVIEW_DEPLOYMENT_OIDC_CLIENT_SECRET: ${{ secrets.PREVIEW_DEPLOYMENT_OIDC_CLIENT_SECRET }} | |
- name: Deploy | |
run: flyctl deploy --app $APP_NAME --image-label v${{ needs.version.outputs.version }} | |
clean: | |
uses: ./.github/workflows/preview-clean.yml | |
secrets: inherit | |
needs: deploy |