mirror of
https://github.com/LukeHagar/Anchor.git
synced 2025-12-06 04:19:08 +00:00
48
.github/workflows/build.yaml
vendored
48
.github/workflows/build.yaml
vendored
@@ -1,15 +1,14 @@
|
||||
name: Build and Upload Chrome Extension
|
||||
name: Build and Create Tag
|
||||
|
||||
run-name: ${{ github.actor }} is Building and Uploading a new Anchor Version 🚀
|
||||
run-name: ${{ github.actor }} is Building and Tagging Anchor Version ${{ github.event.inputs.version }} 🚀
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
inputs:
|
||||
version:
|
||||
description: The version to bump to in "Vx.x.x" format
|
||||
jobs:
|
||||
Build-And-Push:
|
||||
Test-Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract branch name
|
||||
@@ -72,6 +71,12 @@ jobs:
|
||||
commit_message: Updated API Specifications
|
||||
file_pattern: 'src/routes/api-client/*.json'
|
||||
|
||||
- name: Update manifest.json version
|
||||
id: updatePackageJsonVersion
|
||||
if: steps.buildExtension.outcome == 'success'
|
||||
run: |
|
||||
jq '.version = "${{ github.event.inputs.version }}"' static/manifest.json > static/manifest.json.tmp && mv static/manifest.json.tmp static/manifest.json
|
||||
|
||||
- name: Install Dependencies
|
||||
id: installDeps
|
||||
if: steps.buildCC.outcome == 'success'
|
||||
@@ -85,29 +90,14 @@ jobs:
|
||||
run: |
|
||||
cd anchor
|
||||
yarn build
|
||||
zip -r anchor-${{ github.sha }}.zip build
|
||||
|
||||
- name: Archive chrome-extension artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: anchor-${{ github.sha }}
|
||||
path: anchor/anchor-${{ github.sha }}.zip
|
||||
- name: Create Tag
|
||||
run: git tag V${{ github.event.inputs.version }}
|
||||
|
||||
Upload-Extension:
|
||||
name: Upload extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: Build-And-Push
|
||||
steps:
|
||||
- name: Download bundle artifact
|
||||
uses: actions/download-artifact@v3
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
name: anchor-${{ github.sha }}
|
||||
repository: anchor/
|
||||
branch: ${{ steps.extract_branch.outputs.branch }}
|
||||
commit_message: Updated Extension Manifest
|
||||
file_pattern: 'static/manifest.json'
|
||||
|
||||
- name: Upload & release
|
||||
uses: mnao305/chrome-extension-upload@v4.0.1
|
||||
with:
|
||||
file-path: anchor-${{ github.sha }}.zip
|
||||
extension-id: opooagfnjoclbafkbgeeokllilaepiap
|
||||
client-id: ${{ secrets.CI_GOOGLE_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.CI_GOOGLE_CLIENT_SECRET }}
|
||||
refresh-token: ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
|
||||
|
||||
141
.github/workflows/release.yaml
vendored
Normal file
141
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
name: Build and Upload Chrome Extension
|
||||
|
||||
run-name: ${{ github.actor }} is Building and Uploading a new Anchor Version 🚀
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
Build-And-Archive:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
# Checkout the main branch of this repo
|
||||
- name: Checkout PR branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: lukehagar/anchor
|
||||
path: anchor
|
||||
ref: ${{ steps.extract_branch.outputs.branch }}
|
||||
|
||||
# Checkout the main branch of api-specs
|
||||
- name: Checkout API Specs Repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: sailpoint-oss/api-specs
|
||||
path: api-specs
|
||||
ref: main
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Install swagger-cli
|
||||
run: |
|
||||
npm install -g swagger-cli
|
||||
|
||||
- name: Dereference and Bundle Beta API Specification
|
||||
id: buildBeta
|
||||
run: |
|
||||
swagger-cli bundle --dereference api-specs/idn/sailpoint-api.beta.yaml -t json -o anchor/src/routes/api-client/BetaSpec.json
|
||||
|
||||
- name: Dereference and Bundle V3 API Specification
|
||||
id: buildV3
|
||||
if: steps.buildBeta.outcome == 'success'
|
||||
run: |
|
||||
swagger-cli bundle --dereference api-specs/idn/sailpoint-api.v3.yaml -t json -o anchor/src/routes/api-client/V3Spec.json
|
||||
|
||||
- name: Dereference and Bundle V2 API Specification
|
||||
id: buildV2
|
||||
if: steps.buildV3.outcome == 'success'
|
||||
run: |
|
||||
swagger-cli bundle --dereference api-specs/idn/sailpoint-api.v2.yaml -t json -o anchor/src/routes/api-client/V2Spec.json
|
||||
|
||||
- name: Dereference and Bundle CC API Specification
|
||||
id: buildCC
|
||||
if: steps.buildV2.outcome == 'success'
|
||||
run: |
|
||||
swagger-cli bundle --dereference api-specs/idn/sailpoint-api.cc.yaml -t json -o anchor/src/routes/api-client/CCSpec.json
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
repository: anchor/
|
||||
branch: ${{ steps.extract_branch.outputs.branch }}
|
||||
commit_message: Updated API Specifications
|
||||
file_pattern: 'src/routes/api-client/*.json'
|
||||
|
||||
- name: Install Dependencies
|
||||
id: installDeps
|
||||
if: steps.buildCC.outcome == 'success'
|
||||
run: |
|
||||
cd anchor
|
||||
yarn install
|
||||
|
||||
- name: Build Extension
|
||||
id: buildExtension
|
||||
if: steps.installDeps.outcome == 'success'
|
||||
run: |
|
||||
cd anchor
|
||||
yarn build
|
||||
zip -r anchor-${{ github.sha }}.zip build
|
||||
|
||||
- name: Archive chrome-extension artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: anchor-${{ github.sha }}
|
||||
path: anchor/anchor-${{ github.sha }}.zip
|
||||
|
||||
Upload-Extension:
|
||||
name: Upload extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: Build-And-Push
|
||||
env:
|
||||
# you can optionally specify extension ID here, we do this so that
|
||||
# all of our environments (dev, staging, prod) have a consistent ID
|
||||
# we can reference. Otherwise the extension ID is autogenerated.
|
||||
EXTENSION_ID: opooagfnjoclbafkbgeeokllilaepiap
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: '16.10'
|
||||
|
||||
- name: Download bundle artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: anchor-${{ github.sha }}
|
||||
|
||||
- name: Install webstore cli
|
||||
run: |-
|
||||
npm install -g chrome-webstore-upload-cli
|
||||
|
||||
- name: Upload step
|
||||
run: |-
|
||||
chrome-webstore-upload upload --source anchor-${{ github.sha }}.zip --extension-id ${{ env.EXTENSION_ID }} --client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} --client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} --refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}
|
||||
|
||||
Build:
|
||||
needs: Build-And-Archive
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download bundle artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: anchor-${{ github.sha }}
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
Reference in New Issue
Block a user