query as list (#44) #57
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: Create Tag And Release And Publish To NPM | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/**' | |
- '*.md' | |
- 'LICENSE' | |
jobs: | |
createTagAndRelease: | |
runs-on: ubuntu-latest | |
name: Create Tag And Release | |
permissions: write-all | |
outputs: | |
tagName: ${{ env.newTagName }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set Tag Name | |
id: setTag | |
uses: actions-opensource/get-next-tag@v1 | |
- name: Create tag & Release | |
uses: actions/github-script@v6 | |
# https://docs.github.com/en/rest/reference/releases#create-a-release | |
with: | |
script: | | |
console.log("newTagName=${{ env.newTagName }}") | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: "${{ env.newTagName }}", | |
name: "${{ env.newTagName }}", | |
body: "Version ${{ env.newTagName }}", | |
target_commitish: context.sha | |
}); | |
publishToNpm: | |
needs: [ createTagAndRelease ] | |
name: Publish Package to npmjs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm i | |
- run: npm run build | |
- run: npm version ${{ needs.createTagAndRelease.outputs.tagName }} --allow-same-version true --commit-hooks false --git-tag-version false | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publishToDockerHub: | |
needs: [ createTagAndRelease ] | |
name: Publish to docker hub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: barnuri/openapi-toolkit | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |