diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d410440..9fcf24c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,9 +1,10 @@ - -name: Go +name: Go Build and Release on: push: branches: [ "main" ] + tags: + - 'v*' pull_request: branches: [ "main" ] @@ -13,18 +14,54 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - go-version: ['1.20'] + go-version: ['1.25'] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Build + shell: bash + run: | + echo "Building project for ${{ matrix.os }}" + if [ "${{ matrix.os }}" == "windows-latest" ]; then + go build -o nm-decryptor.exe ./... + else + go build -o nm-decryptor ./... + fi - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} + - name: Test + run: go test -v ./... + + - name: Upload Artifact + uses: actions/upload-artifact@v4 # FIXED: Updated from v3 to v4 + with: + name: nm-decryptor-${{ matrix.os }} + path: | + nm-decryptor* + + release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + steps: + - uses: actions/checkout@v4 - - name: Build - run: go build -v ./... + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: release-assets - - name: Test - run: go test -v ./... + - name: Create and Upload GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + files: release-assets/**/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}