Skip to content

Commit

Permalink
ci: simplify gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
Cat committed Jun 4, 2024
1 parent 4471f4a commit 102d293
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
GOAMD64: ${{ matrix.goamd64 }}
CGO_ENABLED: 0
steps:
- name: Checkout codebase
- name: Checkout
uses: actions/checkout@v4

- name: Configure & show workflow information
- name: Generate build information
id: get_filename
run: |
echo "BUILD_TAG: $BUILD_TAG, GOOS: $GOOS, GOARCH: $GOARCH, GOAMD64: $GOAMD64"
Expand Down Expand Up @@ -81,50 +81,41 @@ jobs:

- name: Build netstatus-api-go
run: |
mkdir -p build_assets
mkdir build_assets
if [ $BUILD_TAG != "none" ]; then
go build -v -o build_assets/netstatus-api-go -trimpath -ldflags "-s -w -buildid=" -tags $BUILD_TAG
else
go build -v -o build_assets/netstatus-api-go -trimpath -ldflags "-s -w -buildid="
fi
- name: Prepare to release
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
retry_wait_seconds: 60
max_attempts: 5
command: |
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
cp ${GITHUB_WORKSPACE}/config.json.example ./build_assets/config.json
- name: Prepare config files
run: |
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
cp ${GITHUB_WORKSPACE}/config.json.example ./build_assets/config.json
- name: Create ZIP archive
shell: bash
- name: Create zip archive
run: |
pushd build_assets || exit 1
touch -mt $(date +%Y01010000) *
zip -9vr ../netstatus-api-go-$ASSET_NAME.zip .
popd || exit 1
FILE=./netstatus-api-go-$ASSET_NAME.zip
DGST=$FILE.dgst
openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST
openssl dgst -sha3-256 $FILE | sed 's/([^)]*)//g' >>$DGST
- name: Change the name
run: |
DGST=$FILE.hash.txt
openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >> $DGST
openssl dgst -sha3-256 $FILE | sed 's/([^)]*)//g' >> $DGST
mv build_assets netstatus-api-go-$ASSET_NAME
- name: Upload files to Artifacts
- name: Upload files to artifacts
uses: actions/upload-artifact@v4
with:
name: netstatus-api-go-${{ steps.get_filename.outputs.ASSET_NAME }}
path: |
./netstatus-api-go-${{ steps.get_filename.outputs.ASSET_NAME }}/*
- name: Upload binaries to release
- name: Upload files to release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./netstatus-api-go-${{ steps.get_filename.outputs.ASSET_NAME }}.zip*
Expand Down

0 comments on commit 102d293

Please sign in to comment.