Merge pull request #1237 from cmu-delphi/release/v3.2.9 #29
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@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- 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@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
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-covidcast-*.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@v2 | |
with: | |
repository: cmu-delphi/www-main | |
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
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-covidcast/releases/download/${{ needs.create_release.outputs.tag_name }}/www-covidcast-${{ 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-covidcast | |
commit-message: 'feat: update to COVIDcast ${{ needs.create_release.outputs.tag_name }}' | |
title: 'update to COVIDcast ${{ needs.create_release.outputs.tag_name }}' | |
labels: feat | |
# reviewers: | |
assignees: melange396 | |
body: | | |
update to [COVIDcast ${{ needs.create_release.outputs.tag_name }}](https://github.com/cmu-delphi/www-covidcast/releases/${{ needs.create_release.outputs.tag_name }}) | |
sync_dev: | |
needs: correct_repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
ref: dev | |
ssh-key: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_SSH }} | |
- name: Reset dev branch | |
run: | | |
git fetch origin main:main | |
git merge main | |
git push |