Merge pull request #81 from cmu-delphi/release/v2.1.5 #10
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 Main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
correct_repository: | |
runs-on: ubuntu-latest | |
steps: | |
- name: fail on fork | |
if: github.repository_owner != 'cmu-delphi' | |
run: exit 1 | |
create_release: | |
needs: correct_repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Extract version | |
id: extract_version | |
run: node -pe "'::set-output name=version::' + require('./package.json').version" | |
- name: Create Release | |
id: create_release | |
uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: ${{ steps.extract_version.outputs.version }} | |
publish: true | |
outputs: | |
version: ${{ steps.extract_version.outputs.version }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
tag_name: ${{ steps.create_release.outputs.tag_name }} | |
build_assets: | |
needs: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.OS }}-node2-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node2- | |
- run: npm ci | |
- name: Build Assets | |
run: npm pack | |
- name: Upload Release Asset | |
uses: AButler/[email protected] | |
with: | |
files: 'www-epivis-*.tgz' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ needs.create_release.outputs.tag_name }} | |
update_website: | |
needs: | |
- create_release | |
- build_assets | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
repository: cmu-delphi/www-main | |
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.OS }}-main-node2-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-main-node2- | |
- run: npm ci | |
- name: Update to Latest Release | |
run: | | |
npm install https://github.com/cmu-delphi/www-epivis/releases/download/${{ needs.create_release.outputs.tag_name }}/www-epivis-${{ needs.create_release.outputs.version }}.tgz | |
- name: Create pull request to update COVIDcast | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }} | |
branch: bot/update-epivis | |
commit-message: 'feat: update to EPIVis ${{ needs.create_release.outputs.tag_name }}' | |
title: 'update to EPIVis ${{ needs.create_release.outputs.tag_name }}' | |
labels: feat | |
# reviewers: | |
assignees: melange396 | |
body: | | |
update to [EPIVis ${{ needs.create_release.outputs.tag_name }}](https://github.com/cmu-delphi/www-epivis/releases/${{ needs.create_release.outputs.tag_name }}) | |
sync_dev: | |
needs: correct_repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }} | |
- name: Reset dev branch | |
run: | | |
git fetch origin main:main | |
git reset --hard main | |
- name: Create pull request into dev | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }} | |
branch: bot/sync-main-dev | |
commit-message: 'chore: sync main-dev' | |
base: dev | |
title: 'chore: sync main->dev' | |
labels: chore | |
# reviewers: | |
assignees: melange396 | |
body: | | |
Syncing Main->Dev. |