-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ci/cd workflow to GoMud (#200)
This PR adds a CI/CD workflow to GoMud. GoMud now automatically builds and release to branch changes to `master`. This should make running the mud more approachable for less technically savvy users. (It also appears my auto-linter went to town on the markdown file)
- Loading branch information
1 parent
0f9255d
commit 3e9f5f1
Showing
3 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# This workflow will: build gomud for multiple os/architectures | ||
# archive the binaries and create a new release for users to easily download | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: ["master", "ci-cd-releases"] | ||
|
||
env: | ||
RELEASE_FILENAME: go-mud-release | ||
|
||
jobs: | ||
# test: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Test | ||
# run: go test -v ./... | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.23" | ||
|
||
- name: Create bin directory | ||
run: mkdir -p bin/ | ||
|
||
- name: Copy _datafiles to bin/ | ||
run: cp -r _datafiles bin/ | ||
|
||
- name: Build windows amd64 | ||
run: env GOOS=windows GOARCH=amd64 go build -v -o bin/go-mud-windows_x64.exe . | ||
|
||
- name: Build darwin/arm64 | ||
run: env GOOS=darwin GOARCH=arm64 go build -v -o bin/go-mud-darwin_arm64 . | ||
|
||
- name: Build darwin/amd64 | ||
run: env GOOS=darwin GOARCH=amd64 go build -v -o bin/go-mud-darwin_x64 . | ||
|
||
- name: Build linux/amd64 | ||
run: env GOOS=linux GOARCH=amd64 go build -v -o bin/go-mud-linux_x64 . | ||
|
||
- name: Build linux/arm5 | ||
run: env GOOS=linux GOARCH=arm GOARM=5 go build -v -o bin/go-mud-linux_arm5 . | ||
|
||
- name: Upload bin | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bin-artifact | ||
path: bin/ | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download builds | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: bin-artifact | ||
path: bin/ | ||
|
||
- name: Set short git commit SHA | ||
id: vars | ||
run: | | ||
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | ||
- name: Archive release | ||
uses: thedoctor0/zip-release@master | ||
id: zip-binaries | ||
with: | ||
type: zip | ||
directory: bin | ||
filename: ${{ env.RELEASE_FILENAME }}-${{ env.COMMIT_SHORT_SHA }}.zip | ||
|
||
- name: Release with notes | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: bin/${{ env.RELEASE_FILENAME }}-${{ env.COMMIT_SHORT_SHA }}.zip | ||
tag_name: release-${{ env.COMMIT_SHORT_SHA }} | ||
fail_on_unmatched_files: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
private-notes.txt | ||
**/users/* | ||
**/config-overrides.yaml | ||
bin/ |
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