diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 22f6d780..34d2d335 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -50,7 +50,7 @@ jobs: - name: Upload osctrl bianries uses: actions/upload-artifact@v2 with: - name: osctrl-${{ matrix.components }}-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin + name: osctrl-${{ matrix.components }}-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}-${{ matrix.goos }}-${{ matrix.goarch }} path: ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin - name: Create ZIP of build artifacts diff --git a/.github/workflows/tagged-releases.yml b/.github/workflows/tagged-releases.yml index 4835b478..3f1765e5 100644 --- a/.github/workflows/tagged-releases.yml +++ b/.github/workflows/tagged-releases.yml @@ -6,37 +6,36 @@ on: - 'v*' jobs: - build_and_test: - runs-on: ubuntu-20.04 - strategy: - matrix: - components: ['tls', 'admin', 'api', 'cli'] - goos: ['linux'] - goarch: ['amd64'] - steps: - ######################################## Checkout code ######################################## - - name: Checkout code - uses: actions/checkout@v2 - ######################################## Install go ######################################## - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - run: go version - ######################################## Get GO deps ######################################## - - name: Get GO deps - run: go mod download - ######################################## Build osctrl binaries ######################################## - - name: Build osctrl-tls - run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin ./${{ matrix.components }} - ######################################## Upload artifacts ######################################## - - name: Upload osctrl bianries - uses: actions/upload-artifact@v2 - with: - name: osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin - path: ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin + # build_and_test: + # runs-on: ubuntu-20.04 + # strategy: + # matrix: + # components: ['tls', 'admin', 'api', 'cli'] + # goos: ['linux'] + # goarch: ['amd64'] + # steps: + # ######################################## Checkout code ######################################## + # - name: Checkout code + # uses: actions/checkout@v2 + # ######################################## Install go ######################################## + # - name: Set up Go + # uses: actions/setup-go@v2 + # with: + # go-version: 1.17 + # - run: go version + # ######################################## Get GO deps ######################################## + # - name: Get GO deps + # run: go mod download + # ######################################## Build osctrl binaries ######################################## + # - name: Build osctrl-tls + # run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin ./${{ matrix.components }} + # ######################################## Upload artifacts ######################################## + # - name: Upload osctrl bianries + # uses: actions/upload-artifact@v2 + # with: + # name: osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin + # path: ./bin/osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin release: - needs: [build_and_test] runs-on: ubuntu-20.04 strategy: matrix: @@ -45,13 +44,29 @@ jobs: goarch: ['amd64'] steps: ######################################## Download artifacts ######################################## - - name: Download osctrl bianries + # https://newbedev.com/getting-current-branch-and-commit-hash-in-github-action + - name: Declare GIT hash and branch + id: vars + shell: bash + run: | + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: Download osctrl binaries uses: actions/download-artifact@v2 with: - name: osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin + name: osctrl-${{ matrix.components }}-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}-${{ matrix.goos }}-${{ matrix.goarch }} + + - name: Rename binaries + run: | + mv osctrl-${{ matrix.components }}-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}-${{ matrix.goos }}-${{ matrix.goarch }} \ + osctrl-${{ matrix.components }}-${{ steps.vars.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }} + ######################################## Add binaries to release ######################################## - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: osctrl-${{ matrix.components }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin + #body_path: ${{ github.workspace }}-CHANGELOG.txt + files: osctrl-${{ matrix.components }}-${{ steps.vars.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.bin