Skip to content

Commit

Permalink
add releases workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fariss committed Oct 8, 2024
1 parent 6a12ab8 commit 6992ad0
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/web-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: create capa Explorer Web release

on:
workflow_dispatch:
inputs:
version:
description: 'Version number for the release'
required: true
type: string

jobs:
build-and-store:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set release name
id: set_release_name
run: echo "RELEASE_NAME=capa-explorer-web-${{ github.event.inputs.version }}-${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Check if release already exists
run: |
if ls web/explorer/releases/capa-explorer-web-${{ github.event.inputs.version }}-* 1> /dev/null 2>&1; then
echo "A release with version ${{ github.event.inputs.version }} already exists."
exit 1
fi
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run linting
run: npm run lint

- name: Check formatting
run: npm run format:check

- name: Run tests
run: npm run test

- name: Build bundle
run: npm run build:bundle

- name: Compress bundle
run: |
cd capa-explorer-web
zip -r ../${{ env.RELEASE_NAME }}.zip .
- name: Create releases directory
run: mkdir -p web/explorer/releases

- name: Move release to releases directory
run: mv ${{ env.RELEASE_NAME }}.zip web/explorer/releases/

- name: Commit and push release
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add web/explorer/releases/${{ env.RELEASE_NAME }}.zip
git commit -m "Add release ${{ env.RELEASE_NAME }}"
git push
- name: Clean up
if: always()
run: rm -f ${{ env.RELEASE_NAME }}.zip

0 comments on commit 6992ad0

Please sign in to comment.