Merge pull request #1022 from cmu-delphi/release/v3.3.0 #81
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@v6 | |
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/[email protected] | |
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-main-*.tgz" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ 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 merge main | |
git push |