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