Skip to content

Commit

Permalink
feat: multi-region releases
Browse files Browse the repository at this point in the history
  • Loading branch information
dweller23 committed Jun 7, 2022
1 parent d51e6ef commit ea9d286
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,39 @@ jobs:
# run: npm run test

- name: build
run: npm run build
run: yarn build

- name: deploy
run: npm run deploy
run: yarn deploy

- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main

- name: release
- name: region1 release
id: region1-release
uses: ncipollo/release-action@v1
with:
artifacts: "bin/index.js"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
tag: ${{ steps.package-version.outputs.current-version}}
name: ${{ steps.package-version.outputs.current-version}}
tag: region1-${{ steps.package-version.outputs.current-version}}
name: region1-${{ steps.package-version.outputs.current-version}}

- name: region2 release
id: region2-release
uses: ncipollo/release-action@v1
with:
artifacts: "bin/index.js"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
tag: region2-${{ steps.package-version.outputs.current-version}}
name: region2-${{ steps.package-version.outputs.current-version}}

- name: region1 release link
run: echo "${{ steps.region1-release.outputs.html_url }}"

- name: region2 release link
run: echo "${{ steps.region2-release.outputs.html_url }}"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Staging workflow
name: Promote to Region prod

on:
release:
Expand All @@ -20,6 +20,13 @@ jobs:
script: return context.payload.release.assets[0].name
result-encoding: string

- name: Get region
id: get-region
uses: actions/github-script@v6
with:
script: return context.payload.release.name.split('-')[0]
result-encoding: string

- name: release
uses: dsaltares/fetch-gh-release-asset@master
with:
Expand All @@ -29,5 +36,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
regex: true

- name: log region
run: echo "${{ steps.get-region.outputs.result }}"

- name: deploy
run: npm run deploy
run: yarn deploy
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deploy-with-release-draft-poc",
"version": "0.0.14",
"version": "0.0.15",
"private": true,
"scripts": {
"build": "tsc",
Expand Down

0 comments on commit ea9d286

Please sign in to comment.