Skip to content

Commit

Permalink
Merge pull request #75 from abap34/auto-release
Browse files Browse the repository at this point in the history
リリースの整備
  • Loading branch information
abap34 authored Apr 2, 2024
2 parents bf98e96 + e58e142 commit 40288d9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/dockerhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and push Docker image

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/almo:latest
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release for all platforms

on:
release:
types: [published]

jobs:
build_and_upload:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-14]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build
run: sh build.sh

- name: Upload Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/main
asset_name: ${{ matrix.os }}
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine:latest

RUN apk add --no-cache g++

WORKDIR /app

COPY . .

RUN sh build.sh

ENTRYPOINT [ "./docker-entrypoint.sh" ]
2 changes: 0 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ done

g++ -std=c++20 "$build_dir"almo.cpp -o "$build_dir"almo

mv "$build_dir"almo .

echo "ビルドが完了しました。"
3 changes: 3 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec /app/build/almo "$@"

0 comments on commit 40288d9

Please sign in to comment.