Skip to content

Build application

Build application #2

Workflow file for this run

name: Build application
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag version'
required: true
workflow_call:
inputs:
tag:
type: string
required: true
permissions:
contents: write
pull-requests: write
env:
TAG_NAME: ${{ inputs.tag || github.event.inputs.tag }}
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Detect version
run: echo "New versions is $TAG_NAME"
- name: Checkout the code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 20
check-latest: true
- run: npm ci
- run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: updater
path: dist/index.js
retention-days: 1
pull_request:
runs-on: ubuntu-latest
needs: build
name: Create a Pull Request
steps:
- name: Checkout the code
uses: actions/checkout@v6
- name: Make a title
id: title
run: |
echo "title=🏗️ Build the application version ${TAG_NAME}" >> "$GITHUB_OUTPUT"
- name: Show title
run: echo ${{ steps.title.outputs.title }}
- name: Remove old file
run: rm -f dist/index.js
- uses: actions/download-artifact@v7
with:
name: updater
path: dist
- name: Create a Pull Request
uses: peter-evans/create-pull-request@v8
with:
branch: build/app
branch-suffix: random
delete-branch: true
add-paths: ./dist/index.js
title: ${{ steps.title.outputs.title }}
commit-message: ${{ steps.title.outputs.title }}
body: Application compiled successfully
labels: build