Fix key format of generate rsa private key #31
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 workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: cd serverlet ; go build -v | |
- name: Test | |
run: go test -v ./... | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: serverlet | |
path: serverlet/serverlet | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: | | |
BUILD_TIME=`date -u '+%Y-%m-%d_%H:%M:%S'` | |
COMMIT_HASH=`git rev-parse --short HEAD` | |
cd serverlet ; go build -v -ldflags "-s -w -X 'main.BuildTime=$BUILD_TIME' -X 'main.GitCommitHash=$COMMIT_HASH'" | |
- name: Test | |
run: go test -v ./... | |
- name: Remove Old ReleaseAsset | |
run: | | |
RELEASE_ID=`curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/PichuChen/hatsuaki/releases/tags/nightly | jq '.id'` | |
ASSETS_ID=`curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/PichuChen/hatsuaki/releases/$RELEASE_ID/assets | jq '.[].id'` | |
for id in $ASSETS_ID; do | |
curl -X DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/PichuChen/hatsuaki/releases/assets/$id | |
done | |
- name: Upload Release Asset | |
run: | | |
RELEASE_ID=`curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/PichuChen/hatsuaki/releases/tags/nightly | jq '.id'` | |
curl -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Content-Type: application/octet-stream" \ | |
--data-binary @serverlet/serverlet \ | |
https://uploads.github.com/repos/PichuChen/hatsuaki/releases/$RELEASE_ID/assets?name=serverlet | |