Skip to content

Add Slideshow component #12

Add Slideshow component

Add Slideshow component #12

Workflow file for this run

name: PR Workflow
on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches-ignore:
- 'rc/**'
- 'main'
permissions:
contents: read
deployments: write
issues: write
pull-requests: write
jobs:
build:
if: github.event.action != 'closed'
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
os: ubuntu-latest
node-version: ${{ matrix.node-version }}
test:
if: github.event.action != 'closed'
name: Test
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
os: ubuntu-latest
node-version: ${{ matrix.node-version }}
release:
name: PR Release
needs: [build, test]
runs-on: ubuntu-latest
# Skip on PR close and on release branches
if: github.event.action != 'closed' && !startsWith(github.ref, 'refs/heads/rc/')
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- name: Restore dist/demo directories to cache
uses: actions/cache@v4
id: build-ubuntu-latest-node-v22
with:
path: |
./dist
./demo
./node_modules
key: build-22-${{ github.run_id }}
- name: Generate PR release version
run: npx --package=@aurodesignsystem/auro-cli -- auro pr-release -p ${{ github.event.pull_request.number }}
- name: Publish to NPM
run: npm publish --registry=https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Comment on PR
uses: actions/github-script@v6
with:
script: |
const packageName = require('./package.json').name;
const packageVersion = require('./package.json').version;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
body: `🚀 PR Release Published! \`${packageName}@${packageVersion}\` [View on npmjs.com](https://www.npmjs.com/package/${packageName}/v/${packageVersion})`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy
needs: [build, test]
runs-on: ubuntu-latest
# Skip on PR close
if: github.event.action != 'closed'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Restore dist/demo directories to cache
uses: actions/cache@v4
id: build_cache
with:
path: |
./dist
./demo
./node_modules
key: build-22-${{ github.run_id }}
- name: Deploy slideshow demo
uses: "./.github/actions/surge"
with:
action: deploy
component: slideshow
pr-number: ${{ github.event.pull_request.number }}
demo-path: "./demo"
surge-token: ${{ secrets.AURO_SURGE_TOKEN }}
github-token: ${{ github.token }}
prune:
name: Teardown
runs-on: ubuntu-latest
# Only run on PR close
if: github.event.action == 'closed'
steps:
- uses: actions/checkout@v4
- name: Teardown slideshow from Surge
uses: "./.github/actions/surge"
with:
action: teardown
component: slideshow
pr-number: ${{ github.event.pull_request.number }}
demo-path: "./demo"
surge-token: ${{ secrets.AURO_SURGE_TOKEN }}
github-token: ${{ github.token }}