Update Gscan to the latest version #111
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 Management | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build_and_test: | |
name: Build and test | |
runs-on: ubuntu-20.04 | |
outputs: | |
version_changed: ${{ steps.check_package_version.outputs.changed }} | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm test | |
- name: Check package.json for version change | |
id: check_package_version | |
uses: EndBug/[email protected] | |
- name: Log when version changed | |
if: steps.check_package_version.outputs.changed == 'true' | |
run: 'echo "Version change found in commit ${{ steps.check_package_version.outputs.commit }}! New version: ${{ steps.check_package_version.outputs.version }} (${{ steps.check_package_version.outputs.type }})"' | |
- name: Log when version unchanged | |
if: steps.check_package_version.outputs.changed == 'false' | |
run: 'echo "No version change"' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: assets | |
path: assets/built | |
update_release_draft: | |
name: Update release draft | |
needs: [build_and_test] | |
if: needs.build_and_test.outputs.version_changed == 'false' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Draft release on GitHub | |
uses: release-drafter/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish_release_draft_on_version_bump: | |
name: Publish release draft | |
needs: [build_and_test] | |
if: needs.build_and_test.outputs.version_changed == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
# An existing release draft is published only if there is a version bump in `package.json`. | |
# Throws an error and breaks the job if called regardless. We check for version changes in the | |
# `build_and_test` job first so this job is skipped rather than exited with an error. | |
- name: Publish matching GitHub release draft | |
id: github_release | |
uses: JamesMGreene/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
allow_release_name_update: 'false' | |
- name: Write out the release URL | |
run: echo "Released at $RELEASE_URL" | |
env: | |
RELEASE_URL: ${{ steps.github_release.outputs.release_url }} | |
deploy_theme: | |
name: Deploy theme to Ghost cloud | |
needs: [build_and_test, publish_release_draft_on_version_bump] | |
if: needs.build_and_test.outputs.version_changed == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: assets | |
path: assets/built | |
- name: Deploy Ghost theme | |
uses: TryGhost/[email protected] | |
with: | |
api-url: ${{ secrets.GHOST_ADMIN_API_URL }} | |
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }} | |
exclude: '.* assets/scss/* dist/* postcss.config.js' |