Skip to content

testing build and release in one flow #66

testing build and release in one flow

testing build and release in one flow #66

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
tag:
description: "Tag to simulate (e.g. v1.0.0)"
required: false
type: string
push:
# Avoid duplicate builds on PRs.
branches:
- bj-package
tags:
- "*"
pull_request:
branches:
- bj-package
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
version: [22, 20, 18]
os:
[sfdc-hk-ubuntu-latest, sfdc-hk-macos-latest, sfdc-hk-windows-latest]
name: Node ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4 # java required for testing with wiremock
with:
java-package: jre
java-version: "11"
distribution: "zulu"
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
cache: "npm"
- name: Simulate tag push
if: github.event.inputs.tag != ''
run: |
echo "GITHUB_REF=refs/tags/${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- run: npm install
- run: npm run format:check
- run: npm run lint
- run: npm run test
- run: npm run build
- name: Pack package
if: github.ref == 'refs/heads/bj-package' || startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag != ''
id: pack
shell: bash
run: npm pack
- name: Upload package
if: (github.ref == 'refs/heads/bj-package' || startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag != '') && matrix.version == '22' && matrix.os == 'sfdc-hk-ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: package
path: "*.tgz"
if-no-files-found: error
release:
needs: build
if: github.ref == 'refs/heads/bj-package' || startsWith(github.ref, 'refs/tags/') || github.event.inputs.tag != ''
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: bj-package
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: .
name: package
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
*.tgz
package.json
yarn.lock
README.md
LICENSE
CHANGELOG.md
SECURITY.md
TERMS_OF_USE.md