Build #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
release: | |
types: [published] | |
env: | |
IMAGE_REGISTRY: ghcr.io | |
IMAGE_OWNER: hotarublaze | |
IMAGE_NAME: gotes3mp | |
jobs: | |
build-linux: | |
name: Build Linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
stable: true | |
id: linux-build | |
- name: Build-Linux | |
run: go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux src/*.go | |
- name: Generate default config | |
run: cd build/ &&chmod +x goTES3MP-Linux && ./goTES3MP-Linux | |
- name: GH Release | |
uses: softprops/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
build/goTES3MP-Linux | |
build/config.yaml | |
build-windows: | |
name: Build Windows | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
stable: true | |
id: windows-build | |
- name: Build-Windows | |
run: GOOS=windows GOARCH=amd64 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Windows.exe src/*.go | |
- name: GH Release | |
uses: softprops/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: build/goTES3MP-Windows.exe | |
add-scripts: | |
name: Add Scripts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Compress scripts | |
uses: papeloto/[email protected] | |
with: | |
files: tes3mp/ | |
dest: build/tes3mp-scripts.zip | |
- name: GH Release | |
uses: softprops/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: build/tes3mp-scripts.zip | |
build-dockerImage: | |
runs-on: ubuntu-latest | |
# If running with act, Uncomment below | |
# container: phaze9/action-runner | |
env: | |
DOCKER_CONFIG: $HOME/.docker | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ env.IMAGE_OWNER }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
id: docker_build_x64 | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
platforms: linux/amd64 | |
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }} | |
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} | |
build-args: | | |
BUILD_VERSION=${{ github.event.release.tag_name }} | |
GITHUB_SHA=$GITHUB_SHA |