Skip to content

Commit

Permalink
Build binary using same command as before
Browse files Browse the repository at this point in the history
Add blocker plugin version to version string.
  • Loading branch information
icyflame committed Jul 13, 2024
1 parent 554af2a commit 8ce5108
Showing 1 changed file with 27 additions and 32 deletions.
59 changes: 27 additions & 32 deletions .github/workflows/build-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
go-version: [ '1.22.5' ]
os-flavor: [ 'linux' ]
architecture: [ 'amd64', 'arm', 'arm64' ]
path-to-build: [ './cmd/email-random' ]

steps:
# You can test your matrix by printing the current Go version
Expand Down Expand Up @@ -50,43 +49,39 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Generate plugin configuration based things and make binary
- name: Build binary of CoreDNS
id: build-binary
run: |
OUTPUT_FILE_NAME="./$(basename ${{ matrix.path-to-build }})-${{ matrix.os-flavor }}-${{ matrix.architecture }}"
go generate
make BINARY=$OUTPUT_FILE_NAME
file ./$OUTPUT_FILE_NAME
# - name: Build binary for the given paths
# id: build-binary
# run: |
# echo "Ref: ${{ github.ref }}; Commit: $GITHUB_SHA"
echo "Ref: ${{ github.ref }}; Commit: $GITHUB_SHA"
# OUTPUT_FILE_NAME="./$(basename ${{ matrix.path-to-build }})-${{ matrix.os-flavor }}-${{ matrix.architecture }}"
OUTPUT_FILE_NAME="./coredns-${{ matrix.os-flavor }}-${{ matrix.architecture }}"
# GOOS=${{ matrix.os-flavor }} GOARCH=${{ matrix.architecture }} \
# go build \
# -ldflags="-X \"github.com/icyflame/kindle-my-clippings-parser/internal/env.Version=${{ github.ref }} $GITHUB_SHA\"" \
# -o $OUTPUT_FILE_NAME ${{ matrix.path-to-build }}
go generate
# sha256sum $OUTPUT_FILE_NAME > $OUTPUT_FILE_NAME.checksum
GOOS=${{ matrix.os-flavor }} GOARCH=${{ matrix.architecture }} CGO_ENABLED=0 \
go build -v \
-ldflags="-s -w -X \"github.com/coredns/coredns/coremain.GitCommit=Blocker plugin ${{ github.ref }} $GITHUB_SHA\"" \
-o $OUTPUT_FILE_NAME
# file ./$OUTPUT_FILE_NAME
# file ./$OUTPUT_FILE_NAME.checksum
sha256sum $OUTPUT_FILE_NAME > $OUTPUT_FILE_NAME.checksum
# chmod 755 ./$OUTPUT_FILE_NAME
# chmod 644 ./$OUTPUT_FILE_NAME.checksum
file ./$OUTPUT_FILE_NAME
file ./$OUTPUT_FILE_NAME.checksum
# tar --create --gzip --file ./$OUTPUT_FILE_NAME.tar.gz ./$OUTPUT_FILE_NAME ./$OUTPUT_FILE_NAME.checksum
chmod 755 ./$OUTPUT_FILE_NAME
chmod 644 ./$OUTPUT_FILE_NAME.checksum
# ls -lsh .
tar --create --gzip --file ./$OUTPUT_FILE_NAME.tar.gz ./$OUTPUT_FILE_NAME ./$OUTPUT_FILE_NAME.checksum
# {
# echo 'OUTPUT_FILES<<EOF'
# echo $OUTPUT_FILE_NAME.tar.gz
# echo EOF
# } >> "$GITHUB_OUTPUT"
# - name: Upload binaries if a tag was pushed
# uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: ${{ steps.build-binary.outputs.OUTPUT_FILES }}
ls -lsh .
{
echo 'OUTPUT_FILES<<EOF'
echo $OUTPUT_FILE_NAME.tar.gz
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Upload binaries if a tag was pushed
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.build-binary.outputs.OUTPUT_FILES }}

0 comments on commit 8ce5108

Please sign in to comment.