Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Gellipapa authored Jan 16, 2024
1 parent 82f2705 commit f544c3a
Showing 1 changed file with 56 additions and 15 deletions.
71 changes: 56 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release GitHub Actions With Some Inputs
name: Simple Release GitHub Actions

on:
workflow_call:
Expand All @@ -12,7 +12,11 @@ on:
description: Given release zip name
required: true
web:
type: boolean
type: string
description: If the value is true then it builds web files, if not then it is a simple release.
required: false
versionNumber:
type: string
description: If the value is true then it builds web files, if not then it is a simple release.
required: false
jobs:
Expand All @@ -21,6 +25,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Convert 'web' input to boolean and set as env var
run: |
if [ "${{ inputs.web }}" = "true" ]; then
echo "WEB=true" >> $GITHUB_ENV
else
echo "WEB=" >> $GITHUB_ENV
fi
- name: Install archive tools
run: sudo apt install zip

Expand All @@ -30,41 +41,71 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}

- name: 'Setup node'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 17

- name: Setup node with dependency path
if: ${{ env.WEB }}
uses: actions/setup-node@v3
with:
node-version: 17
cache: 'npm'
cache-dependency-path: web/package-lock.json

- name: Install dependencies
if: inputs.web
if: ${{ env.WEB }}
run: npm i
working-directory: web

- name: Run build
if: inputs.web
if: ${{ env.WEB }}
run: npm run build
working-directory: web
env:
CI: false

- name: Download Bump manifest version js file and run in node

- name: Get Previous tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 1.0.0
- name: Get next minor version
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: Create new milestone
id: createmilestone
uses: "WyriHaximus/github-action-create-milestone@v1"
with:
title: ${{ steps.semvers.outputs.patch }}
- name: Set Release Version
id: set_version
run: |
if [ "${{ inputs.versionNumber }}" != "" ]; then
echo "DETERMINED_VERSION=${{ inputs.versionNumber }}" >> $GITHUB_ENV
else
echo "DETERMINED_VERSION=${{ steps.semvers.outputs.patch }}" >> $GITHUB_ENV
fi
- name: 'Download Bump manifest version js file and run in node'
run: curl -f https://raw.githubusercontent.com/CommunityRP-FiveM-Server/.github/961b50cd10fdda968a7a8a4b78af5fd2447cf650/.github/actions/bump-manifest-version.js | node -
env:
TGT_RELEASE_VERSION: ${{ github.ref_name }}

TGT_RELEASE_VERSION: ${{ env.DETERMINED_VERSION }}
- name: Push manifest change
uses: EndBug/add-and-commit@v8
with:
add: fxmanifest.lua
push: true
author_name: Manifest Bumper
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: 'chore: bump manifest version to ${{ github.ref_name }}'
message: 'chore: bump manifest version to ${{ env.DETERMINED_VERSION }}'

- name: Update tag ref
uses: EndBug/latest-tag@latest
with:
tag-name: ${{ github.ref_name }}
tag-name: ${{ env.DETERMINED_VERSION }}

- name: Create exclude file from input
run: |
Expand All @@ -74,7 +115,7 @@ jobs:
done
- name: Bundle web files
if: inputs.web
if: ${{ env.WEB }}
run: |
mkdir -p ./temp/${{ inputs.zipName }}
mkdir -p ./temp/${{ inputs.zipName }}/web
Expand All @@ -85,8 +126,8 @@ jobs:
mkdir -p ./temp/${{ inputs.zipName }}
if [[ -f exclude.txt ]]; then
rsync -av --progress --exclude=temp/ --exclude-from=exclude.txt --exclude=exclude.txt ./ ./temp/${{ inputs.zipName }}/
elif [[ "${{ inputs.web }}" == "true" ]]; then
rsync -av --progress --exclude=temp/ --exclude-from=exclude.txt --exclude=exclude.txt --exclude=.git --exclude=.github ./ ./temp/${{ inputs.zipName }}/
elif [[ "${{ env.WEB }}" == "true" ]]; then
rsync -av --progress --exclude=temp/ --exclude=.git --exclude=.github --include=web/dist/** --exclude=web/** ./ ./temp/${{ inputs.zipName }}/
else
rsync -av --progress --exclude=temp/ --exclude=.git --exclude=.github ./ ./temp/${{ inputs.zipName }}/
Expand All @@ -99,7 +140,7 @@ jobs:
id: auto_release
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
title: '${{ env.RELEASE_VERSION }}'
automatic_release_tag: ${{ env.DETERMINED_VERSION }}
prerelease: false
files: ${{ inputs.zipName }}.zip

Expand Down

0 comments on commit f544c3a

Please sign in to comment.