Deploy Release #229
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: Deploy Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version" | |
required: true | |
# Only allow one workflow instance for this branch to run at a time | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
# This workflow is split into release and prerelease jobs so that the | |
# release job can require a manual approval. Otherwise, the release and | |
# prerelease jobs should be identical. | |
jobs: | |
validate: | |
name: "Validate" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: adobe/project-card-release-automation/validate-version@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ github.event.inputs.version }} | |
release: | |
name: "Release" | |
runs-on: ubuntu-latest | |
needs: validate | |
# this environment requires manual approval | |
environment: Production | |
# final release versions do not contain '-' | |
if: ${{ contains(github.event.inputs.version, '-') == false }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.4.x | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: | | |
${{ secrets.ALLOY_BOT_GITHUB_SSH_PRIVATE_KEY }} | |
${{ secrets.CDN_PRIVATE_KEY }} | |
- uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }} # increment NPM_CACHE_VERSION secret to force cache reset | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- run: ./scripts/deploy.js ${{ github.event.inputs.version }} latest | |
env: | |
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: | | |
./dist/alloy.js | |
./dist/alloy.min.js | |
prerelease: | |
name: "Prerelease" | |
runs-on: ubuntu-latest | |
needs: validate | |
# prerelease versions contain '-' | |
if: ${{ contains(github.event.inputs.version, '-') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.4.x | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: | | |
${{ secrets.ALLOY_BOT_GITHUB_SSH_PRIVATE_KEY }} | |
${{ secrets.CDN_PRIVATE_KEY }} | |
- uses: actions/cache@v2 | |
id: npm-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }} # increment NPM_CACHE_VERSION secret to force cache reset | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- run: ./scripts/deploy.js ${{ github.event.inputs.version }} next | |
env: | |
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: | | |
./dist/alloy.js | |
./dist/alloy.min.js | |
record: | |
name: "Record Version" | |
runs-on: ubuntu-latest | |
needs: [prerelease, release] | |
if: failure() == false | |
steps: | |
- uses: adobe/project-card-release-automation/record-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: ${{ github.event.inputs.version }} |