Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Upgrade workflows (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
illright authored Mar 1, 2024
1 parent f045539 commit d7ed7b4
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 124 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false
uses: actions/checkout@v4

- name: Fetch the version number 📝
id: fetch-version
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/attractions/package.json`);
return `v${package.version}`;
- name: Fetch the changelog 📝
id: fetch-changelog
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const changelog = require('fs').readFileSync('CHANGELOG.md', { encoding: 'utf-8' }).split('\n');
Expand All @@ -40,9 +36,8 @@ jobs:
return changelog.slice(start + 1, end).join('\n').trim();
- name: Create a release 🔖
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.repos.createRelease({
owner: context.repo.owner,
Expand Down
34 changes: 12 additions & 22 deletions .github/workflows/build-pr-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build docs from a pull request
on:
pull_request:
paths:
- .github/workflows/**
- attractions/**
- docs/**
- CHANGELOG.md
Expand All @@ -18,49 +19,38 @@ jobs:
working-directory: docs
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Set up Node 14 📦
uses: actions/setup-node@v2
with:
node-version: '14'
uses: actions/checkout@v4

- name: Cache pnpm modules 🗄
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- name: Use pnpm
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
version: ^8.10.2

- name: Install pnpm 🧰
uses: pnpm/action-setup@v2.0.1
- name: Set up Node 20 📦
uses: actions/setup-node@v4
with:
version: 6.14.2
node-version: '20'
cache: pnpm

- name: Build docs 🔧
env:
SAPPER_APP_BASEPATH: attractions/${{ github.event.number }}
run: |
pnpm install
pnpm run export -- --basepath attractions/${{ github.event.number }}
pnpm run export --basepath attractions/${{ github.event.number }}
- name: Save the PR number 📩
run: echo "${{ github.event.number }}" > ../pr_number.txt
# The ".." is to go outside the docs directory

- name: Upload the PR number 📤
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr_number.txt

- name: Upload the built docs 📤
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/__sapper__/export/attractions/${{ github.event.number }}/
9 changes: 4 additions & 5 deletions .github/workflows/deploy-pr-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download the docs artifact 📥
uses: dawidd6/action-download-artifact@891cccee4b25d3306cf5edafa174ddc1d969871f
uses: dawidd6/action-download-artifact@a430ac5786b39ad5869da25a98130624d2ce340c
with:
workflow: build-pr-docs.yml
commit: ${{ github.event.workflow_run.head_sha }}
name: docs
path: ./docs

- name: Download the PR number artifact 📥
uses: dawidd6/action-download-artifact@891cccee4b25d3306cf5edafa174ddc1d969871f
uses: dawidd6/action-download-artifact@a430ac5786b39ad5869da25a98130624d2ce340c
with:
workflow: build-pr-docs.yml
name: pr_number
Expand All @@ -30,17 +30,16 @@ jobs:
run: echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV

- name: Publish 🚀
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501
uses: peaceiris/actions-gh-pages@4eb285e828117bca26638192c3ed309c622e7bad
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
destination_dir: ${{ env.PR_NUMBER }}
keep_files: true

- name: Post the URL on the PR 🖊
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script:
| # yeah, I know it's weird how you get PR comments with `.issues`
const prComments = (await github.issues.listComments({
Expand Down
27 changes: 8 additions & 19 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Set up Node 14 📦
uses: actions/setup-node@v2
with:
node-version: '14'
uses: actions/checkout@v4

- name: Cache pnpm modules 🗄
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- name: Use pnpm
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
version: ^8.10.2

- name: Install pnpm 🧰
uses: pnpm/action-setup@v2.0.1
- name: Set up Node 20 📦
uses: actions/setup-node@v4
with:
version: 6.14.2
node-version: '20'
cache: pnpm

- name: Install dependencies 🧰
run: pnpm install
Expand Down
31 changes: 10 additions & 21 deletions .github/workflows/manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,28 @@ jobs:
working-directory: docs
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Set up Node 14 📦
uses: actions/setup-node@v2
with:
node-version: '14'
uses: actions/checkout@v4

- name: Cache pnpm modules 🗄
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- name: Use pnpm
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
version: ^8.10.2

- name: Install pnpm 🧰
uses: pnpm/action-setup@v2.0.1
- name: Set up Node 20 📦
uses: actions/setup-node@v4
with:
version: 6.14.2
node-version: '20'
cache: pnpm

- name: Install and build 🔧
env:
SAPPER_APP_BASEPATH: attractions/${{ github.event.inputs.prefix }}
run: |
pnpm install
pnpm run export -- --basepath attractions/${{ github.event.inputs.prefix }}
pnpm run export --basepath attractions/${{ github.event.inputs.prefix }}
- name: Publish 🚀
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501
uses: peaceiris/actions-gh-pages@4eb285e828117bca26638192c3ed309c622e7bad
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/__sapper__/export/attractions/${{ github.event.inputs.prefix }}
Expand Down
60 changes: 19 additions & 41 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,28 @@ jobs:
working-directory: docs
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false
uses: actions/checkout@v4

- name: Set up Node 14 📦
uses: actions/setup-node@v2
- name: Use pnpm
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
node-version: '14'
version: ^8.10.2

- name: Cache pnpm modules 🗄
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- name: Set up Node 20 📦
uses: actions/setup-node@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Install pnpm 🧰
uses: pnpm/[email protected]
with:
version: 6.14.2
node-version: '20'
cache: pnpm

- name: Build docs 🔧
env:
SAPPER_APP_BASEPATH: attractions
run: |
pnpm install
pnpm run export -- --basepath attractions
pnpm run export --basepath attractions
- name: Publish 🚀
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501
uses: peaceiris/actions-gh-pages@4eb285e828117bca26638192c3ed309c622e7bad
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/__sapper__/export/attractions/
Expand All @@ -55,30 +44,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false
uses: actions/checkout@v4

- name: Set up Node 14 📦
uses: actions/setup-node@v2
- name: Use pnpm
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
version: ^8.10.2

- name: Cache pnpm modules 🗄
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- name: Set up Node 20 📦
uses: actions/setup-node@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Install pnpm 🧰
uses: pnpm/[email protected]
with:
version: 6.14.2
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: pnpm

- name: Build bundles 🔧
run: |
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/suggest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false
uses: actions/checkout@v4

- name: Add the [new release] tag 🔖
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/attractions/package.json`);
const currentVersion = `v${package.version}`;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"private": true,
"scripts": {
"lint-js": "eslint . --ext \".svelte,.js\" --cache",
"lint-js:fix": "pnpm run lint-js -- --fix",
"lint-js:fix": "pnpm run lint-js --fix",
"lint-css": "stylelint . --cache",
"lint-css:fix": "pnpm run lint-css -- --fix",
"lint-css:fix": "pnpm run lint-css --fix",
"lint-svelte": "svelte-check --workspace attractions --diagnostic-sources svelte,css --output human --fail-on-warnings && svelte-check --workspace docs --diagnostic-sources svelte,css --output human --fail-on-warnings --ignore \"src/node_modules\"",
"lint-svelte:fix": "svelte-check --workspace attractions && svelte-check --workspace docs --ignore \"src/node_modules\"",
"lint-format": "prettier --plugin-search-dir=. --check .",
Expand Down

0 comments on commit d7ed7b4

Please sign in to comment.