From f7ee34308c5e3f33c429b5a4420ccaa463240adb Mon Sep 17 00:00:00 2001 From: vmfunc Date: Sat, 12 Oct 2024 23:22:34 +0200 Subject: [PATCH] chore: auto-release script --- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ .github/workflows/runtest.yml | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c6d0434 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +on: + push: + branches: [main] + +jobs: + test: + uses: ./.github/workflows/runtest.yml + + build-and-release: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + + - name: Build for Windows + run: GOOS=windows GOARCH=amd64 go build -o sif-windows-amd64.exe ./cmd/sif + + - name: Build for macOS + run: GOOS=darwin GOARCH=amd64 go build -o sif-macos-amd64 ./cmd/sif + + - name: Build for Linux + run: GOOS=linux GOARCH=amd64 go build -o sif-linux-amd64 ./cmd/sif + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.sha }} + release_name: Release ${{ github.sha }} + draft: false + prerelease: false + + - name: Upload Windows Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./sif-windows-amd64.exe + asset_name: sif-windows-amd64.exe + asset_content_type: application/octet-stream + + - name: Upload macOS Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./sif-macos-amd64 + asset_name: sif-macos-amd64 + asset_content_type: application/octet-stream + + - name: Upload Linux Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./sif-linux-amd64 + asset_name: sif-linux-amd64 + asset_content_type: application/octet-stream diff --git a/.github/workflows/runtest.yml b/.github/workflows/runtest.yml index a1f2424..39324e3 100644 --- a/.github/workflows/runtest.yml +++ b/.github/workflows/runtest.yml @@ -19,7 +19,7 @@ jobs: run: make - name: Run Sif with features run: | - ./sif -u https://google.com -dnslist small -dirlist small -ports common -dork -git -whois -cms + ./sif -u https://google.com -dnslist small -dirlist small -dork -git -whois -cms if [ $? -eq 0 ]; then echo "Sif ran successfully" else