.github/workflows/generate.yml #8
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
on: | |
repository_dispatch: | |
types: [generate] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Ref of aj-foster/open-api-generator | |
required: true | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
generate: | |
name: Generate Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Ref (Repository Dispatch) | |
if: github.event_name == 'repository_dispatch' | |
run: | | |
echo "REF=${{ github.event.client_payload.ref }}" >> $GITHUB_ENV" | |
- name: Setup Ref (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup BEAM | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "25.2" | |
elixir-version: "1.14.2" | |
- name: Generate Code | |
run: | | |
elixir generate.exs "$REF" | |
- name: Save Code | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add output/ | |
git commit -m "Generated output for aj-foster/open-api-generator@$REF" | |
git tag -f "oapi_generator/$REF" | |
git push --tags --force |