fix inconsistency #176
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: "Publish package and docs" | |
on: [push] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
env: | |
AURI_GITHUB_TOKEN: ${{secrets.AURI_GITHUB_TOKEN}} | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | |
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_API_TOKEN_V2}} | |
jobs: | |
publish-package: | |
name: Publish package | |
runs-on: ubuntu-latest | |
outputs: | |
changesets: ${{steps.check-changesets.outputs.changesets}} | |
steps: | |
- name: Setup actions | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: "https://registry.npmjs.org/" | |
- name: Install dependencies | |
run: npm install | |
- name: Prepare release | |
run: npx auri prepare ${{ github.ref_name }} | |
- name: Publish package | |
run: npx auri publish ${{ github.ref_name }} | |
check-changesets: | |
name: Check changesets | |
needs: publish-package | |
runs-on: ubuntu-latest | |
outputs: | |
changesets: ${{steps.check-changesets.outputs.changesets}} | |
steps: | |
- name: Check if ".changesets" directory has files | |
id: check-changesets | |
run: | | |
if [ -z "$(ls -A .changesets)" ]; then | |
echo "changesets=0" >> "$GITHUB_OUTPUT" | |
else | |
echo "changesets=1" >> "$GITHUB_OUTPUT" | |
fi | |
publish-docs: | |
name: Publish docs | |
needs: check-changesets | |
if: needs.check-changesets.check-changesets.outputs.changesets == 0 && github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Set up actions | |
uses: actions/checkout@v3 | |
- name: Install malta | |
working-directory: docs | |
run: | | |
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz | |
tar -xvzf malta.tgz | |
- name: build | |
working-directory: docs | |
run: ./linux-amd64/malta build | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "docs/dist" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
publish-v2-docs: | |
name: Publish v2 docs | |
runs-on: ubuntu-latest | |
needs: check-changesets | |
if: needs.check-changesets.check-changesets.outputs.changesets == 0 && github.ref_name == 'v2' | |
steps: | |
- name: setup actions | |
uses: actions/checkout@v3 | |
- name: setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.5.1 | |
registry-url: https://registry.npmjs.org | |
- name: install malta | |
working-directory: docs | |
run: | | |
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz | |
tar -xvzf malta.tgz | |
- name: build | |
working-directory: docs | |
run: ./linux-amd64/malta build | |
- name: install wrangler | |
run: npm i -g wrangler | |
- name: deploy | |
run: wrangler pages deploy docs/dist --project-name arctic-v2 --branch main |