Skip to content

trigger-action

trigger-action #71

name: Secure Shop9ja Release
on:
push:
branches:
- main
repository_dispatch:
types: [trigger-action]
permissions:
contents: write
jobs:
create-tag:
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
node-version: '20'
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
default_bump: minor
tag_prefix: ""
release:
needs: create-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
repository: ${{ secrets.APP_REPO }}
token: ${{ env.GH_TOKEN }}
path: 'app'
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Check DNS resolution
run: nslookup registry.yarnpkg.com
- name: Configure yarn registry
run: yarn config set registry https://registry.yarnpkg.com
- name: Install Dependencies
run: |-
cd app
yarn install
- name: Link API Client Package
run: |-
cd app/packages/api-client
yarn link
- name: Install Electron Dependencies
run: |-
cd app/desktop-app
yarn install
yarn link "@packages/api-client"
- name: build-linux
if: matrix.os == 'ubuntu-latest'
run: |-
cd app/desktop-app
yarn build:linux
- name: build-mac
if: matrix.os == 'macos-latest'
run: |-
cd app/desktop-app
yarn build:mac
- name: build-win
if: matrix.os == 'windows-latest'
run: |-
cd app/desktop-app
yarn build:win
# latest -> lae -> dist
- name: Remove spaces in file names - (mac & linux)
if: matrix.os != 'windows-latest'
run: |
cd app/desktop-app
mkdir -p formatted-dist
for file in dist/*; do
mv "$file" "formatted-dist/$(echo $file | tr ' ' '-' | sed 's|dist/||')"
done
- name: Remove spaces in file names - (windows)
if: matrix.os == 'windows-latest'
run: |
cd app\desktop-app
mkdir formatted-dist -ErrorAction Ignore
Get-ChildItem dist\* -File | ForEach-Object {
$newName = $_.Name -replace ' ', '-'
Move-Item $_.FullName -Destination ("formatted-dist\" + $newName)
}
shell: pwsh
- name: release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.create-tag.outputs.new_tag }}
name: Release ${{ needs.create-tag.outputs.new_tag }}
body: 'Changes in this Release: ${{ needs.create-tag.outputs.changelog }}'
token: ${{ env.GH_TOKEN }}
draft: false
prerelease: false
files: |
app/desktop-app/formatted-dist/*.exe
app/desktop-app/formatted-dist/*.zip
app/desktop-app/formatted-dist/*.dmg
app/desktop-app/formatted-dist/*.AppImage
app/desktop-app/formatted-dist/*.snap
app/desktop-app/formatted-dist/*.deb
app/desktop-app/formatted-dist/*.rpm
app/desktop-app/formatted-dist/*.tar.gz
app/desktop-app/formatted-dist/*.yml
app/desktop-app/formatted-dist/*.blockmap