Skip to content

Commit

Permalink
refine build files
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Feb 20, 2024
1 parent cf60a4c commit 2ffe4a2
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 142 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Desktop Versions

on: [push, pull_request, workflow_dispatch]

jobs:
build_desktop:
name: Build Desktop on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Create env file
run: |
touch .env
echo SENTRY_ENABLED=1 >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
- name: Install dependencies and build
run: npm i -f; npm run build
- name: Build
uses: samuelmeuli/[email protected]
with:
github_token: ${{ secrets.github_token }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
skip_build: true
## - name: Get current version
## uses: Saionaro/[email protected]
## id: package-version
## - name: Upload Artifact
## uses: actions/upload-artifact@v2
## if: matrix.os == 'ubuntu-latest'
## with:
## name: 'TallyArbiter-${{ steps.package-version.outputs.version }}-Linux'
## path: 'release/TallyArbiter-${{ steps.package-version.outputs.version }}.AppImage'
## - name: Upload Artifact
## uses: actions/upload-artifact@v2
## if: matrix.os == 'macos-latest'
## with:
## name: 'TallyArbiter-${{ steps.package-version.outputs.version }}-MacOS'
## path: 'release/TallyArbiter-${{ steps.package-version.outputs.version }}.dmg'
## - name: Upload Artifact
## uses: actions/upload-artifact@v2
## if: matrix.os == 'windows-latest'
## with:
## name: 'TallyArbiter-${{ steps.package-version.outputs.version }}-Windows'
## path: 'release/TallyArbiter Setup ${{ steps.package-version.outputs.version }}.exe'
142 changes: 0 additions & 142 deletions .github/workflows/build.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish to DockerHub

on: [push, pull_request, workflow_dispatch]

jobs:
build_docker:
name: Build Docker image on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies and build
run: npm i -f; npm run build
- name: Set up QEMU
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
if: startsWith(github.ref, 'refs/tags/v')
id: buildx
uses: docker/setup-buildx-action@master
- name: Get Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: josephdadams/tallyarbiter
tags: |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=tag
flavor: |
latest=false
- name: Login to DockerHub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create env file
run: |
touch .env
echo SENTRY_ENABLED=1 >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
- name: Build and push
if: startsWith(github.ref, 'refs/tags/v') != true
uses: docker/build-push-action@v5
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push (multiarch)
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/s390x,linux/arm/v7,linux/arm/v6
35 changes: 35 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to NPM

on: [push, pull_request, workflow_dispatch]

jobs:
build_cli:
name: Build and Publish to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm i -f
- name: Create env file
run: |
touch .env
echo SENTRY_ENABLED=1 >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
- name: Build
run: npm pack
- name: NPM Publish
if: startsWith(github.ref, 'refs/tags/v')
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_ACCESS_TOKEN }}
## - uses: Saionaro/[email protected]
## id: package-version
## - name: Upload Artifact
## uses: actions/upload-artifact@v2
## with:
## name: 'TallyArbiter-${{ steps.package-version.outputs.version }}'
## path: 'TallyArbiter-${{ steps.package-version.outputs.version }}.tgz'

0 comments on commit 2ffe4a2

Please sign in to comment.