release-trigger #498
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: Release | |
on: | |
repository_dispatch: | |
types: [release-trigger] | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ukcp-api-release | |
cancel-in-progress: false | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
# | |
# ENVIRONMENT DEPENDENCIES SETUP | |
# | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: composer:v2 | |
# Setup all the yarn things and node modules | |
- name: Setup Yarn | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16' | |
- name: Get Yarn Cache Directory | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Load Yarn Cache | |
uses: actions/cache@v1 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Load Cached Node Modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
# Install yarn things | |
- name: Install Assets | |
run: yarn | |
# Generate Release | |
# This will trigger the deployment workflow | |
- name: Semantic Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
GH_TOKEN: ${{ secrets.PAT }} | |
run: yarn semantic-release | |
trigger-deployment: | |
name: Trigger Deployment | |
needs: release | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger Deploy workflow | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.PAT }} | |
event-type: deploy-trigger |