cli/.github/workflows/publish.yml
Jake Cooper 6f8f9a6e61
Grab Tag from Client Payload (#251)
* Manually grab tag

* Use new tag

* Also set the sha
2022-08-03 17:13:51 -04:00

90 lines
2.5 KiB
YAML

name: Publish
on:
repository_dispatch:
types: [publish-event]
jobs:
release_and_brew:
name: Release and bump Brew
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
id: go
with:
go-version: ^1.13
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
- name: Bump Homebrew Core
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{ secrets.GH_PAT }}
formula: railway
tag: ${{ github.event.client_payload.new-tag }}
revision: ${{ github.event.client_payload.sha }}
publish_npm:
name: Publish to NPM
needs: release_and_brew
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set version
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Check version
run: echo "Version ${{ github.event.client_payload.new-tag }}"
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Setup Git user
run: |
git config --global user.name "Github Bot"
git config --global user.email "github-bot@railway.app"
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Bump NPM version
run: npm --no-git-tag-version --allow-same-version version ${{ github.event.client_payload.new-tag }}
- name: NPM publish
run: npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Discord Deployment Status Notification
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DEPLOY_WEBHOOK }}
status: ${{ job.status }}
title: "Published CLI"
description: "Published CLI version ${{ github.event.client_payload.new-tag }} to Brew and NPM"
nofail: false
nodetail: false
username: Github Actions
avatar_url: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png