Skip to content

Commit

Permalink
Add releases and Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Nov 13, 2021
1 parent f2a75fe commit d09ee96
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 31 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/build.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Release on Linux

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: uwpr/comet

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Comet
run: make && ./comet.exe -p

- name: Prepare release
run: |
mkdir release && \
cp comet.exe release/comet && \
cp README.md release/README.md && \
tar -czv linux.tar.gz release
- name: Upload binaries to the release
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: linux.tar.gz
overwrite: true

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Log in to the GitHub Container registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Test the Docker image
if: ${{ github.event_name != 'release' }}
run: docker run ${REGISTRY}/${{ env.IMAGE_NAME }}:main comet -p
33 changes: 33 additions & 0 deletions .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Release on MacOS

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build Comet
run: make && ./comet.exe -p

- name: Prepare release
run: |
mkdir release && \
cp comet.exe release/comet && \
cp README.md release/README.md && \
zip -r macos.zip release
- name: Upload binaries to the release
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: macos.zip
overwrite: true
39 changes: 39 additions & 0 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Release on Windows

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.1

- name: Build Comet
run: |
msbuild Comet.sln -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v142 -tv:Current
- name: Prepare release
shell: bash
run: |
mkdir release && \
cp comet.exe release/comet.exe && \
cp README.md release/README.md && \
zip -r windows.zip release
- name: Upload binaries to the release
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: windows.zip
overwrite: true
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:18.04

RUN apt-get update && \
apt-get install procps -y && \
apt-get clean

WORKDIR /app

COPY comet.exe ./comet

ENV PATH="/app:$PATH"

0 comments on commit d09ee96

Please sign in to comment.