Updated publish swagger workflow to be triggered for tags

This commit is contained in:
Alejandro Celaya 2021-12-11 13:17:45 +01:00
parent c48a3a24f7
commit ec11155c9c

View file

@ -1,14 +1,9 @@
name: Publish swagger spec name: Publish swagger spec
on: on:
workflow_dispatch: push:
inputs: tags:
version: - 'v*'
description: The version to generate
required: true
# push:
# tags:
# - 'v*'
jobs: jobs:
build: build:
@ -19,10 +14,10 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
# - name: Determine version - name: Determine version
# id: determine_version id: determine_version
# run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}" run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
# shell: bash shell: bash
- name: Use PHP - name: Use PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
@ -32,18 +27,14 @@ jobs:
coverage: none coverage: none
- run: composer install --no-interaction --prefer-dist - run: composer install --no-interaction --prefer-dist
- run: composer swagger:inline - run: composer swagger:inline
# - run: mkdir ${{ steps.determine_version.outputs.version }} - run: mkdir ${{ steps.determine_version.outputs.version }}
- run: mkdir ${{ github.event.inputs.version }} - run: mv docs/swagger/swagger-inline.json ${{ steps.determine_version.outputs.version }}/oas.json
# - run: mv docs/swagger/swagger-inline.json ${{ steps.determine_version.outputs.version }}/oas.json
- run: mv docs/swagger/swagger-inlined.json ${{ github.event.inputs.version }}/oas.json
- name: Publish spec - name: Publish spec
uses: JamesIves/github-pages-deploy-action@4.1.7 uses: JamesIves/github-pages-deploy-action@4.1.7
with: with:
token: ${{ secrets.OAS_PUBLISH_TOKEN }} token: ${{ secrets.OAS_PUBLISH_TOKEN }}
repository-name: 'shlinkio/shlink-open-api-specs' repository-name: 'shlinkio/shlink-open-api-specs'
branch: main branch: main
# folder: ${{ steps.determine_version.outputs.version }} folder: ${{ steps.determine_version.outputs.version }}
folder: ${{ github.event.inputs.version }} target-folder: specs/${{ steps.determine_version.outputs.version }}
# target-folder: specs/${{ steps.determine_version.outputs.version }}
target-folder: specs/${{ github.event.inputs.version }}
clean: false clean: false