Add github build script trigger when on master branch #584
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: Optimizely Headless Form CI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- release/** | |
pull_request: | |
branches: | |
- "*" | |
- master | |
- feature/** | |
- release/** | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }} | |
JIRA_USERNAME: ${{ secrets.JIRA_BOT_USERNAME }} | |
JIRA_PASSWORD: ${{ secrets.JIRA_BOT_PASSWORD }} | |
jobs: | |
build_test_pack: | |
name: Build, test, and publish | |
runs-on: windows-latest | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
strategy: | |
matrix: | |
node-version: [16.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Setup dependencies | |
run: npm ci | |
- name: Run build SDK | |
run: npm run build --if-present | |
- name: Run unit test | |
run: npm test | |
- name: Apply Versioning | |
run: | | |
echo "running on branch" ${{env.BRANCH_NAME}} | |
${{ github.workspace}}/build/get-versionSuffix.ps1 ${{env.BRANCH_NAME}} ${{github.RUN_NUMBER}} | |
- name: Publish | |
if: ${{ contains(github.ref,'release/') || github.ref == 'refs/heads/master'}} | |
run: npm run publish | |
jira-release: | |
if: ${{ contains(github.ref,'release/') }} | |
runs-on: windows-latest | |
name: Get release version & create JIRA release | |
needs: build_test_pack | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Get release version | |
uses: episerver/addons-jira-automation/releaseversion@v1 | |
id: branchVersion | |
- name: Create JIRA release | |
uses: episerver/addons-jira-automation/release@v1 | |
with: | |
jira-project: AFORM | |
jira-package: Optimizely.Forms.Headless.Js.Sdk | |
jira-host: jira.sso.episerver.net | |
version: ${{ steps.branchVersion.outputs.manifestSafeVersionString }} | |
versionSuffix: ${{needs.build_test_pack.outputs.versionSuffix}} |