Skip to content

Commit

Permalink
feat: github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Liang0028 committed Sep 18, 2024
1 parent 02098bf commit 73aafbf
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build-and-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and Package LINSTOR GUI

on:
pull_request:
branches: [main]

push:
tags:
- 'v*' # This will trigger the workflow for any tag starting with 'v'

jobs:
build-and-package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.14.0'

- name: Get the latest tag
id: get_tag
run: |
git fetch --tags
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest_tag=$TAG" >> $GITHUB_ENV
# Create the .env file with VERSION
- name: Create .env file
run: |
echo "VERSION=${{ env.latest_tag }}" > .env
working-directory: ./

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Package
run: |
mkdir linstor-gui-${{ env.latest_tag }}
mv dist/* linstor-gui-${{ env.latest_tag }}
tar -czvf linstor-gui-${{ env.latest_tag }}.tar.gz -C linstor-gui-${{ env.latest_tag }} .
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linstor-gui-${{ env.latest_tag }}.tar.gz
path: linstor-gui-${{ env.latest_tag }}.tar.gz

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.latest_tag }}
release_name: 'LINSTOR GUI v${{ env.latest_tag }}'
draft: false
prerelease: false

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_tag.outputs.upload_url }}
asset_path: ./linstor-gui-${{ env.latest_tag }}.tar.gz
asset_name: linstor-gui-${{ env.latest_tag }}.tar.gz
asset_content_type: application/gzip

0 comments on commit 73aafbf

Please sign in to comment.