Skip to content

Deploy Release

Deploy Release #179

Workflow file for this run

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@v2
- uses: actions/setup-node@v1
with:
node-version: 15.x
- uses: webfactory/ssh-agent@v0.5.3
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 }} latest
env:
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
- uses: actions/upload-artifact@v2
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@v2
- uses: actions/setup-node@v1
with:
node-version: 15.x
- uses: webfactory/ssh-agent@v0.5.3
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@v2
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 }}