-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
28 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,50 @@ | ||
name: Build and Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Go"] # Name of the workflow to listen for | ||
types: | ||
- completed # Trigger this workflow when the Go workflow completes | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Only run if the Go workflow succeeded | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21' # Set your Go version | ||
|
||
- name: Extract version | ||
id: get_version | ||
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV # Use the branch/tag name | ||
|
||
- name: Build for Linux | ||
run: | | ||
GOOS=linux GOARCH=amd64 go build -o dockermi-linux-${{ env.VERSION }} main.go | ||
tar -czvf dockermi-linux-${{ env.VERSION }}.tar.gz dockermi-linux-${{ env.VERSION }} | ||
- name: Build for macOS | ||
run: | | ||
GOOS=darwin GOARCH=amd64 go build -o dockermi-macos-${{ env.VERSION }} main.go | ||
tar -czvf dockermi-macos-${{ env.VERSION }}.tar.gz dockermi-macos-${{ env.VERSION }} | ||
- name: Build for Windows | ||
run: | | ||
GOOS=windows GOARCH=amd64 go build -o dockermi-${{ env.VERSION }}.exe main.go | ||
zip dockermi-${{ env.VERSION }}.zip dockermi-${{ env.VERSION }}.exe | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag: ${{ github.ref_name }} # Use the branch/tag name | ||
files: | | ||
dockermi-linux-${{ env.VERSION }}.tar.gz | ||
dockermi-macos-${{ env.VERSION }}.tar.gz | ||
dockermi-${{ env.VERSION }}.zip | ||
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 |
---|---|---|
@@ -1,38 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Function to build the application for Linux or macOS | ||
build_app() { | ||
echo "Building for $1..." | ||
GOOS="$1" GOARCH=amd64 go build -o dockermi main.go | ||
echo "Build completed! The executable is dockermi." | ||
} | ||
|
||
# Function to install the application | ||
install_app() { | ||
case "$1" in | ||
linux) | ||
echo "Installing dockermi on Linux..." | ||
cp dockermi /usr/local/bin/dockermi | ||
chmod +x /usr/local/bin/dockermi | ||
echo "dockermi installed! You can run it by typing 'dockermi' in your terminal." | ||
;; | ||
darwin) | ||
echo "Installing dockermi on macOS..." | ||
cp dockermi /usr/local/bin/dockermi | ||
chmod +x /usr/local/bin/dockermi | ||
echo "dockermi installed! You can run it by typing 'dockermi' in your terminal." | ||
;; | ||
*) | ||
echo "Unsupported operating system for installation: $1" | ||
exit 1 | ||
;; | ||
esac | ||
echo "Installing dockermi on $1..." | ||
cp dockermi /usr/local/bin/dockermi | ||
chmod +x /usr/local/bin/dockermi | ||
echo "dockermi installed! You can run it by typing 'dockermi' in your terminal." | ||
} | ||
|
||
# Detect the operating system | ||
# Detect the operating system and perform actions | ||
OS="$(uname -s)" | ||
case "$OS" in | ||
Linux) | ||
build_app linux | ||
install_app linux | ||
;; | ||
Darwin) | ||
build_app darwin | ||
install_app darwin | ||
;; | ||
*) | ||
echo "This script only supports Linux and macOS." | ||
exit 1 | ||
;; | ||
esac | ||
esac |
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
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