release #16745
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: release | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
branches: | |
- main | |
inputs: | |
force-release: | |
default: false | |
description: "try to release even with no changes" | |
required: false | |
type: boolean | |
concurrency: | |
group: release | |
jobs: | |
release-action: | |
runs-on: ubuntu-latest | |
name: release | |
steps: | |
- name: checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
token: ${{ github.token }} | |
fetch-depth: 0 | |
- name: remote-commit | |
id: remote-commit | |
env: | |
URL: https://github.com/interline-io/transitland-server.git | |
run: | | |
echo "::set-output name=sha::$(git ls-remote ${URL} HEAD | awk '{ print $1}')" | |
- name: commit-store | |
id: commit-store | |
uses: boredland/action-commit-store@1dc8f93e093a9d3d1ba6da3ef46fe06802a4fe74 # 1.3.1 | |
with: | |
storage-commit-sha: 3755750738397a632761958464ebbda4f87fd7ad | |
key: last-commit | |
value: ${{ steps.remote-commit.outputs.sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- id: skip | |
if: steps.commit-store.outputs.updated == 'false' && github.event_name == 'schedule' | |
run: | | |
echo "::set-output name=value::true" | |
- name: setup node | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 | |
if: steps.skip.outputs.value != 'true' | |
with: | |
node-version: 'lts/*' | |
cache: 'yarn' | |
- name: install | |
if: steps.skip.outputs.value != 'true' | |
run: yarn --frozen-lockfile | |
- name: generate | |
if: steps.skip.outputs.value != 'true' | |
run: yarn generate | |
- name: test | |
if: steps.skip.outputs.value != 'true' | |
run: yarn test | |
env: | |
TRANSITLAND_API_KEY: ${{ secrets.TRANSITLAND_API_KEY }} | |
TRANSITLAND_URL: ${{ secrets.TRANSITLAND_URL }} | |
- name: commit changes | |
if: steps.skip.outputs.value != 'true' | |
id: changes | |
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4 | |
with: | |
commit_message: "chore(update): automated client update" | |
- name: release | |
if: github.event.inputs.force-release == 'true' || steps.changes.outputs.changes_detected == 'true' | |
run: | | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |