Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions Workflow to build and publish #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
push:
branches:
- github-actions
- master
tags:
- 'v**'
pull_request:
paths-ignore:
- 'docs/**'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Build
working-directory: ./N80
env:
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || '' }}
run: |
./build.sh
if [ -n "$IS_RELEASE" ]; then
./zip.sh
fi
- name: Publish artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: N80/Release/zips/*.zip
tag: ${{ github.ref }}
overwrite: true
11 changes: 2 additions & 9 deletions N80/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@
# Or build only the publish profile supplied as argument (e.g: build.sh SelfContained__win_x64)
# The built programs are placed in <N80 project root>/Release.

output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}
# using sh, source command does not exist
. ./functions.sh

publish() {
dotnet publish ../Nestor80.sln /p:PublishProfile=$1 /p:DebugType=None -c Release
}

banner() {
echo
output 6 "----- $1 -----"
echo
}

set -e

mkdir -p Release
Expand Down
13 changes: 13 additions & 0 deletions N80/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

output() {
TPUTARGS=""
[ -n "$GITHUB_ACTIONS" ] && TPUTARGS="-T xterm-256color"
echo "$(tput ${TPUTARGS} setaf "$1")$2$(tput ${TPUTARGS} sgr0)"
}

banner() {
echo
output 6 "----- $1 -----"
echo
}
11 changes: 2 additions & 9 deletions N80/zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
# Generate ZIP files for all the variants inside the <project root>/Release/zips directory.
# You need to run build.sh first in order to actually have something to zip!

output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}

banner() {
echo
output 6 "----- $1 -----"
echo
}
# using sh, source command does not exist
. ./functions.sh

set -e

Expand Down