mirror of
https://github.com/multipleof4/git.planetrenox.com.git
synced 2026-01-13 16:07:55 +00:00
Update deploy.yml
This commit is contained in:
36
.github/workflows/deploy.yml
vendored
36
.github/workflows/deploy.yml
vendored
@@ -1,24 +1,26 @@
|
|||||||
|
name: deploy-gitea-gce
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
permissions:
|
||||||
app:
|
contents: read
|
||||||
description: 'App to deploy'
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
options: [gitea, runner]
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
||||||
GITEA_APP_NAME: ${{ vars.FLY_APP_NAME }}
|
|
||||||
RUNNER_APP_NAME: ${{ vars.RUNNER_APP_NAME }}
|
|
||||||
GITEA_URL: ${{ vars.GITEA_URL }}
|
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN: ${{ secrets.GITEA_RUNNER_REGISTRATION_TOKEN }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: superfly/flyctl-actions/setup-flyctl@master
|
- name: Extract project_id
|
||||||
- if: github.event.inputs.app == 'gitea'
|
id: pj
|
||||||
run: flyctl apps create "${GITEA_APP_NAME:?FLY_APP_NAME var not set}" --org personal || true; flyctl volumes create gitea_data --size 1 --region lax -a "$GITEA_APP_NAME" --yes || true; flyctl secrets set -a "$GITEA_APP_NAME" --stage "GITEA__server__DOMAIN=${GITEA_URL:?GITEA_URL var not set}" "GITEA__server__ROOT_URL=https://${GITEA_URL}"; flyctl deploy --remote-only -c fly.toml -a "$GITEA_APP_NAME"
|
run: |
|
||||||
- if: github.event.inputs.app == 'runner'
|
echo "pid=$(jq -r .project_id <<< '${{ secrets.GCP_SA_KEY_JSON }}')" >> $GITHUB_OUTPUT
|
||||||
run: flyctl apps create "${RUNNER_APP_NAME:?RUNNER_APP_NAME var not set}" --org personal || true; flyctl volumes create runner_data --size 1 --region lax -a "$RUNNER_APP_NAME" --yes || true; flyctl secrets set -a "$RUNNER_APP_NAME" --stage "GITEA_INSTANCE_URL=https://${GITEA_URL:?GITEA_URL var not set}" "GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN:?GITEA_RUNNER_REGISTRATION_TOKEN secret not set}"; flyctl deploy --remote-only -c runner/fly.toml -a "$RUNNER_APP_NAME"
|
- uses: google-github-actions/auth@v2
|
||||||
|
with:
|
||||||
|
credentials_json: ${{ secrets.GCP_SA_KEY_JSON }}
|
||||||
|
- uses: hashicorp/setup-terraform@v3
|
||||||
|
- name: Terraform Init
|
||||||
|
working-directory: terraform
|
||||||
|
run: terraform init
|
||||||
|
- name: Terraform Apply
|
||||||
|
working-directory: terraform
|
||||||
|
env:
|
||||||
|
TF_VAR_project_id: ${{ steps.pj.outputs.pid }}
|
||||||
|
run: terraform apply -auto-approve
|
||||||
Reference in New Issue
Block a user