Release 0.2.0 #1
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: Diffs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Ref of aj-foster/open-api-generator | |
required: true | |
type: string | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
generate: | |
name: Generate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Ref (Push) | |
if: github.event_name == 'push' | |
run: | | |
echo "REF=main" >> $GITHUB_ENV | |
- name: Setup Ref (Pull Request) | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "REF=$GITHUB_HEAD_REF" >> $GITHUB_ENV | |
- name: Setup Ref (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV | |
- name: Checkout (Diffs) | |
uses: actions/checkout@v4 | |
with: | |
repository: "aj-foster/open-api-diffs" | |
ref: main | |
path: diffs | |
- name: Checkout (Generator) | |
uses: actions/checkout@v4 | |
with: | |
repository: "aj-foster/open-api-generator" | |
path: generator | |
- name: Setup BEAM | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "27.0" | |
elixir-version: "1.17.1" | |
- name: Generate Code | |
run: | | |
cd diffs/ | |
elixir generate.exs "$REF" | |
- name: Save Code | |
run: | | |
cd generator/ | |
git checkout --orphan temporary-branch | |
git rm -rf . | |
mv ../diffs/output . | |
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 "_diff/$REF" | |
git push --tags --force | |
- name: Summary | |
if: github.event_name == 'pull_request' | |
run: echo "[Changes to Generated Files](https://github.com/aj-foster/open-api-generator/compare/_diff/main.._diff/$REF)" >> $GITHUB_STEP_SUMMARY |