-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Change to work within theorchard
- Loading branch information
1 parent
e368d64
commit 550afec
Showing
8 changed files
with
180 additions
and
456 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: 'songwhip-events dispatch action' | ||
description: 'Trigger a songwhip-event' | ||
|
||
inputs: | ||
event: | ||
description: 'Event object' | ||
required: true | ||
context: | ||
description: 'Additional event context' | ||
required: false | ||
|
||
runs: | ||
using: 'node12' | ||
main: './index.js' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { songwhipEventApi } = require('@theorchard/songwhip-events'); | ||
|
||
const inputs = { | ||
event: process.env.INPUT_EVENT, | ||
context: process.env.INPUT_CONTEXT, | ||
}; | ||
|
||
(async () => { | ||
const event = JSON.parse( | ||
inputs.event || '{}'.replace(/\n/g, ' ').replace(/ +/g, ' ') | ||
); | ||
|
||
const context = JSON.parse( | ||
inputs.context || '{}'.replace(/\n/g, ' ').replace(/ +/g, ' ') | ||
); | ||
|
||
await songwhipEventApi({ | ||
event, | ||
context, | ||
}); | ||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Pull request | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy preview | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: ./scripts/create-npmrc ${{ secrets.NPM_GITHUB_TOKEN }} | ||
- uses: bahmutov/npm-install@v1 | ||
|
||
- uses: amondnet/vercel-action@v20 | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ github.token }} | ||
vercel-org-id: team_1ufGuAGpA6R9b1EzxNxFVcNk | ||
vercel-project-id: QmeyLmZ7W1GyfBPGrduX2oTQowiRiZiYWeUJMKcJRY8eFJ | ||
scope: team_1ufGuAGpA6R9b1EzxNxFVcNk |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Push master | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy production | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: ./scripts/create-npmrc ${{ secrets.NPM_GITHUB_TOKEN }} | ||
- uses: bahmutov/npm-install@v1 | ||
|
||
- uses: amondnet/vercel-action@v20 | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ github.token }} | ||
vercel-org-id: team_1ufGuAGpA6R9b1EzxNxFVcNk | ||
vercel-project-id: QmeyLmZ7W1GyfBPGrduX2oTQowiRiZiYWeUJMKcJRY8eFJ | ||
scope: team_1ufGuAGpA6R9b1EzxNxFVcNk | ||
# --prod uses production domain (telegram.songwhip.com) | ||
vercel-args: '--prod' | ||
|
||
# this workflow is triggered by a 'push' event so the `event` payload doesn't | ||
# contain information about the pull-request, this action fetches that data so that | ||
# we can dispatch a useful message & url with the 'new-deployment' songwhip-event | ||
- uses: actions-ecosystem/action-get-merged-pull-request@v1 | ||
id: get-merged-pull-request | ||
with: | ||
github_token: ${{ github.token }} | ||
|
||
# a pull-request will be found when we merge into master from a pull-request (almost always) | ||
- name: Dispatch 'new-deployment' event | ||
uses: ./.github/actions/songwhip-events | ||
if: ${{ steps.get-merged-pull-request.outputs.title != null }} | ||
with: | ||
event: '{ "type": "new-deployment", "serviceName": "songwhip-telegram", "message": "${{ steps.get-merged-pull-request.outputs.title }}", "url": "https://github.com/theorchard/songwhip-telegram/pull/${{ steps.get-merged-pull-request.outputs.number }}" }' | ||
context: '{ "env": "production" }' | ||
|
||
# if we didn't find a merged pr, use the head_commit, this will happen if ever we | ||
# push to master instead of merging into master from a pull-request (emergency only?) | ||
- name: Dispatch 'new-deployment' event | ||
uses: ./.github/actions/songwhip-events | ||
if: ${{ steps.get-merged-pull-request.outputs.title == null }} | ||
with: | ||
event: '{ "type": "new-deployment", "serviceName": "songwhip-telegram", "message": "${{ github.event.head_commit.message }}", "url": "https://github.com/theorchard/songwhip-telegram/commit/${{ github.event.head_commit.id }}" }' | ||
context: '{ "env": "production" }' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
.now | ||
.npmrc | ||
.vercel | ||
|
||
node_modules |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
AUTH_TOKEN=$1 | ||
DIR="$(cd "$(dirname "$0")" && pwd)" | ||
NPMRC=$DIR/../.npmrc | ||
|
||
# delete any existing .npmrc | ||
rm $NPMRC 2> /dev/null | ||
|
||
# create the .npmrc so that npm can see theorchard private packages | ||
echo "@theorchard:registry=https://npm.pkg.github.com/" >> $NPMRC | ||
echo "//npm.pkg.github.com/:_authToken=${AUTH_TOKEN}" >> $NPMRC |
Oops, something went wrong.