diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d56ecb8..02746ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,153 +1,155 @@ name: Build on: - push: - branches: - - master - workflow_dispatch: + push: + branches: + - master + tags-ignore: + - "**" + workflow_dispatch: jobs: - build-linux: - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install Linux dependencies - run: | - sudo apt update - sudo apt install -y wget pkg-config libsdl2-dev - - - name: Install Go dependencies - run: go get -v - - - name: Build - run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w" - - - name: Update executable - run: | - chmod +x impregnate - mv impregnate impregnate.Linux - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-linux - path: impregnate.Linux - - build-mac: - runs-on: macos-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install dependencies - run: brew install pkg-config sdl2 - - - name: Install Go dependencies - run: go get -v - - - name: Build - run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w" - - - name: Update executable - run: | - chmod +x impregnate - mv impregnate impregnate.MacOS - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-macos - path: impregnate.MacOS - - build-windows: - runs-on: windows-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup MSYS2 - uses: msys2/setup-msys2@v2 - - - name: Install Windows dependencies - shell: msys2 {0} - run: | - pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - - - name: Install Go dependencies - shell: msys2 {0} - run: | - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - go get -v - - - name: Build - shell: msys2 {0} - run: | - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui" - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-windows - path: impregnate.exe - - release: - runs-on: ubuntu-latest - needs: [build-linux, build-mac, build-windows] - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - uses: actions/download-artifact@v2 - with: - name: impregnate-linux - path: linux - - - uses: actions/download-artifact@v2 - with: - name: impregnate-macos - path: macos - - - uses: actions/download-artifact@v2 - with: - name: impregnate-windows - path: windows - - - name: Create release - run: | - gh release delete ${{ env.VERSION }} -y || true - gh release create ${{ env.VERSION }} -p -t "${{ env.NAME }}" -n "${{ github.event.head_commit.message }}" ${{ env.FILES }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION: 'dev' - NAME: 'Impregnate Dev' - FILES: linux/impregnate.Linux macos/impregnate.MacOS windows/impregnate.exe + build-linux: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/heads/') + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Linux dependencies + run: | + sudo apt update + sudo apt install -y wget pkg-config libsdl2-dev + + - name: Install Go dependencies + run: go get -v + + - name: Build + run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w" + + - name: Update executable + run: | + chmod +x impregnate + mv impregnate impregnate.Linux + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-linux + path: impregnate.Linux + + build-mac: + runs-on: macos-latest + if: startsWith(github.ref, 'refs/heads/') + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: brew install pkg-config sdl2 + + - name: Install Go dependencies + run: go get -v + + - name: Build + run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w" + + - name: Update executable + run: | + chmod +x impregnate + mv impregnate impregnate.MacOS + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-macos + path: impregnate.MacOS + + build-windows: + runs-on: windows-latest + if: startsWith(github.ref, 'refs/heads/') + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + + - name: Install Windows dependencies + shell: msys2 {0} + run: | + pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + + - name: Install Go dependencies + shell: msys2 {0} + run: | + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + go get -v + + - name: Build + shell: msys2 {0} + run: | + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui" + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-windows + path: impregnate.exe + + release: + runs-on: ubuntu-latest + needs: [build-linux, build-mac, build-windows] + if: startsWith(github.ref, 'refs/heads/') + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: impregnate-linux + path: linux + + - uses: actions/download-artifact@v2 + with: + name: impregnate-macos + path: macos + + - uses: actions/download-artifact@v2 + with: + name: impregnate-windows + path: windows + + - name: Create release + run: | + gh release delete ${{ env.VERSION }} -y || true + gh release create ${{ env.VERSION }} -p -t "${{ env.NAME }}" -n "${{ github.event.head_commit.message }}" ${{ env.FILES }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: "dev" + NAME: "Impregnate Dev" + FILES: linux/impregnate.Linux macos/impregnate.MacOS windows/impregnate.exe diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81a6f5e..e524b6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,158 +1,157 @@ name: Release on: - push: - tags: - - v* + push: + tags: + - v* jobs: - build-linux: - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install Linux dependencies - run: | - sudo apt update - sudo apt install -y wget pkg-config libsdl2-dev - - - name: Install Go dependencies - run: go get -v - - - name: Build - run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w" - - - name: Update executable - run: | - chmod +x impregnate - mv impregnate impregnate.Linux - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-linux - path: impregnate.Linux - - build-mac: - runs-on: macos-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install dependencies - run: brew install pkg-config sdl2 - - - name: Install Go dependencies - run: go get -v - - - name: Build - run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w" - - - name: Update executable - run: | - chmod +x impregnate - mv impregnate impregnate.MacOS - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-macos - path: impregnate.MacOS - - build-windows: - runs-on: windows-latest - if: startsWith(github.ref, 'refs/heads/') - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.17.1' - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup MSYS2 - uses: msys2/setup-msys2@v2 - - - name: Install Windows dependencies - shell: msys2 {0} - run: | - pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - - - name: Install Go dependencies - shell: msys2 {0} - run: | - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - go get -v - - - name: Build - shell: msys2 {0} - run: | - export GOROOT=/mingw64/lib/go - export GOPATH=/mingw64 - CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui" - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: impregnate-windows - path: impregnate.exe - - release: - runs-on: ubuntu-latest - needs: [build-linux, build-mac, build-windows] - if: startsWith(github.ref, 'refs/heads/') - - steps: - - uses: actions/download-artifact@v2 - with: - name: impregnate-linux - path: linux - - - uses: actions/download-artifact@v2 - with: - name: impregnate-macos - path: macos - - - uses: actions/download-artifact@v2 - with: - name: impregnate-windows - path: windows - - - name: Get some values needed for the release - id: release_values - run: | - echo "::set-output name=date::$(date '+%Y-%m-%d')" - echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" - - - name: Create the release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: ${{ steps.release_values.outputs.tag }}, ${{ steps.release_values.outputs.date }} - draft: true - prerelease: false - body_path: .github/release_body_template.md - files: | - linux/impregnate.Linux - macos/impregnate.MacOS - windows/impregnate.exe \ No newline at end of file + build-linux: + runs-on: ubuntu-latest + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Linux dependencies + run: | + sudo apt update + sudo apt install -y wget pkg-config libsdl2-dev + + - name: Install Go dependencies + run: go get -v + + - name: Build + run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -tags static -ldflags "-s -w" + + - name: Update executable + run: | + chmod +x impregnate + mv impregnate impregnate.Linux + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-linux + path: impregnate.Linux + + build-mac: + runs-on: macos-latest + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: brew install pkg-config sdl2 + + - name: Install Go dependencies + run: go get -v + + - name: Build + run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -tags static -ldflags "-s -w" + + - name: Update executable + run: | + chmod +x impregnate + mv impregnate impregnate.MacOS + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-macos + path: impregnate.MacOS + + build-windows: + runs-on: windows-latest + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.17.1" + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + + - name: Install Windows dependencies + shell: msys2 {0} + run: | + pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-go + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + + - name: Install Go dependencies + shell: msys2 {0} + run: | + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + go get -v + + - name: Build + shell: msys2 {0} + run: | + export GOROOT=/mingw64/lib/go + export GOPATH=/mingw64 + CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -tags static -ldflags "-s -w -H=windowsgui" + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: impregnate-windows + path: impregnate.exe + + release: + runs-on: ubuntu-latest + needs: [build-linux, build-mac, build-windows] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: impregnate-linux + path: linux + + - uses: actions/download-artifact@v2 + with: + name: impregnate-macos + path: macos + + - uses: actions/download-artifact@v2 + with: + name: impregnate-windows + path: windows + + - name: Get some values needed for the release + id: release_values + run: | + echo "::set-output name=date::$(date '+%Y-%m-%d')" + echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" + + - name: Create the release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: ${{ steps.release_values.outputs.tag }}, ${{ steps.release_values.outputs.date }} + draft: true + prerelease: false + body_path: .github/release_body_template.md + files: | + linux/impregnate.Linux + macos/impregnate.MacOS + windows/impregnate.exe diff --git a/middle/version.go b/middle/version.go index e9b19eb..864abea 100644 --- a/middle/version.go +++ b/middle/version.go @@ -1,3 +1,3 @@ package middle -const version = "0.0.2" +const version = "1.0.0"