Generate Action #70
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: Generate Action | |
on: | |
workflow_dispatch: | |
env: | |
LIQUIBASE_VERSION: 4.25.1 | |
jobs: | |
create-command-list: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: create list | |
run: make create-list VERSION=$LIQUIBASE_VERSION | |
- id: set-matrix | |
run: echo "matrix=$(cat commands.json)" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: commands-$LIQUIBASE_VERSION | |
path: commands.json | |
create-action-repo: | |
env: | |
TF_VAR_BOT_TOKEN: ${{ secrets.GHA_GENERATOR_ADMIN_TOKEN }} | |
TF_TOKEN_spacelift_io: ${{ secrets.SPACELIFT_API_KEY }} | |
runs-on: ubuntu-latest | |
needs: [ create-command-list ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: commands-$LIQUIBASE_VERSION | |
path: ./ | |
- name: Terraform Format | |
id: fmt | |
run: terraform fmt | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
run: terraform plan -no-color -lock=false | |
continue-on-error: true | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
run: terraform apply -auto-approve -lock=false | |
continue-on-error: true | |
- name: Terraform State Push | |
run: terraform state push errored.tfstate -lock=false | |
generate-action: | |
runs-on: ubuntu-latest | |
needs: [ create-command-list, create-action-repo ] | |
strategy: | |
matrix: | |
commands: ${{ fromJSON(needs.create-command-list.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: echo ${{ matrix.commands }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
repo-token: ${{ secrets.BOT_TOKEN }} | |
- run: make generate VERSION=$LIQUIBASE_VERSION COMMAND="${{ matrix.commands }}" | |
- name: Configure git user | |
run: | | |
git config --global init.defaultBranch main | |
git config --global user.name "liquibot" | |
git config --global user.email "[email protected]" | |
- name: Push Action to Repo | |
run: ./scripts/push-to-repository.sh "${{ matrix.commands }}" $LIQUIBASE_VERSION | |
env: | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
output-action: | |
runs-on: ubuntu-latest | |
needs: [ generate-action ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: commands-$LIQUIBASE_VERSION | |
path: ./ | |
- name: Output Action Edit Link | |
run: ./scripts/output-release-edit.sh "v$LIQUIBASE_VERSION" |