Release #65
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: | |
workflow_dispatch: | |
inputs: | |
dryRun: | |
description: 'Do a dry run to preview instead of a real release' | |
required: true | |
default: 'true' | |
jobs: | |
authorize: | |
name: Authorize | |
runs-on: macos-12 | |
steps: | |
- name: ${{ github.actor }} permission check to do a release | |
uses: "lannonbr/repo-permission-check-action@2.0.2" | |
with: | |
permission: "write" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: Release | |
runs-on: macos-12 | |
needs: [authorize] | |
strategy: | |
matrix: | |
ruby-version: ["2.7.x"] | |
env: | |
GIT_AUTHOR_NAME: amplitude-sdk-bot | |
GIT_AUTHOR_EMAIL: amplitude-sdk-bot@users.noreply.github.com | |
GIT_COMMITTER_NAME: amplitude-sdk-bot | |
GIT_COMMITTER_EMAIL: amplitude-sdk-bot@users.noreply.github.com | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: node_modules cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v2.1.5 | |
with: | |
node-version: 16.x | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn prepare | |
- name: Setup Ruby | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: Cache Bundle Gems and Cocoapods | |
id: cache-gems-pods | |
uses: actions/cache@v3 | |
with: | |
path: | | |
Pods | |
vendor/bundle | |
key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/Gemfile.lock') }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
- name: Install Cocoapods | |
if: steps.cache-gems-pods.outputs.cache-hit != 'true' | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
- name: Release --dry-run # Uses release.config.js | |
if: ${{ github.event.inputs.dryRun == 'true'}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: yarn release --dry-run | |
- name: Release # Uses release.config.js | |
if: ${{ github.event.inputs.dryRun == 'false'}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: yarn release | |
gh-pages: | |
name: Publish to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: [authorize] | |
steps: | |
#This step checks out a copy of your repository. Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Runs a single command using the runners shell | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2.1.5 | |
with: | |
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0 | |
node-version: 16.x | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Generate website assets | |
run: yarn docs:gen-docs | |
- name: Add key to allow access to repository | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
cat <<EOT >> ~/.ssh/config | |
Host github.com | |
HostName github.com | |
IdentityFile ~/.ssh/id_rsa | |
EOT | |
- name: Release to GitHub Pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
yarn docs:deploy -u "amplitude-sdk-bot <amplitude-sdk-bot@users.noreply.github.com>" |