Add workflow_dispatch trigger to npm publish workflow #365
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: build and upload artifacts | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
tag_name: | |
type: string | |
description: "The tag name of the release without v prefix" | |
env: | |
VERSION: ${{ inputs.tag_name }} | |
jobs: | |
build: | |
name: build and upload artifacts | |
strategy: | |
matrix: | |
include: | |
- os: windows-2022 | |
arch: amd64 | |
target: windows | |
ext: .exe | |
- os: ubuntu-20.04 | |
arch: amd64 | |
target: linux | |
- os: ubuntu-20.04 | |
arch: arm64 | |
target: linux | |
- os: macos-13 | |
arch: amd64 | |
target: darwin | |
- os: macos-14 | |
arch: arm64 | |
target: darwin | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: ./server | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: installing dependencies | |
uses: ./.github/actions/install | |
with: | |
os: ${{ matrix.os }} | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check if VERSION exists | |
shell: bash | |
id: check_version | |
run: | | |
if [ ! -z "${{ env.VERSION }}" ]; then | |
echo "PRODUCTION=true" >> $GITHUB_ENV | |
fi | |
- name: Build Server | |
shell: bash | |
run: task build:server | |
env: | |
OS: ${{ matrix.target }} | |
ARCH: ${{ matrix.arch }} | |
- name: Rename Server artifact | |
run: mv build/deweb-server${{ matrix.ext }} build/deweb-server_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }} | |
- name: Upload Server artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deweb-server_${{ matrix.target }}_${{ matrix.arch }} | |
path: server/build/deweb-server_${{ matrix.target }}_${{ matrix.arch }}${{ matrix.ext }} |