Skip to content

Commit

Permalink
ci: add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Oct 26, 2024
1 parent 7808eb8 commit cf36ad8
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 22 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build dotnet

on:
push:
branches: ["master"]

permissions:
contents: read
packages: write # Grant write permission to packages

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
working-directory: pmcenter
run: dotnet restore --configfile NuGet.conf

- name: Build
working-directory: pmcenter
run: dotnet build --no-restore -c Release

- name: Upload GitHub Artifact
uses: actions/upload-artifact@v4
with:
name: pmcenter
path: ./pmcenter/bin/Release/net8.0/**/*

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/pmcenter:latest
ghcr.io/${{ github.repository_owner }}/pmcenter:${{ github.sha }}
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-alpine
FROM mcr.microsoft.com/dotnet/aspnet:8.0

ARG LOCALE=en
WORKDIR /opt
WORKDIR /opt/pmcenter

RUN mkdir pmcenter \
&& cd pmcenter \
&& wget https://see.wtf/pmcenter-update -O pmcenter.zip \
&& unzip pmcenter.zip \
&& rm pmcenter.zip
ADD locales/pmcenter_locale_$LOCALE.json /opt/pmcenter/pmcenter_locale.json
COPY pmcenter/bin/Release/net8.0/ .

CMD ["dotnet","/opt/pmcenter/pmcenter.dll"]
ADD locales/pmcenter_locale_$LOCALE.json ./pmcenter_locale.json

CMD ["dotnet", "./pmcenter.dll"]
13 changes: 0 additions & 13 deletions Dockerfile-lazer

This file was deleted.

0 comments on commit cf36ad8

Please sign in to comment.