diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index c3ecf54b..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,100 +0,0 @@ -name: Release - -on: - push: - tags: - - "v*" - -jobs: - release: - name: Release - runs-on: ubuntu-22.04 - permissions: - contents: write - packages: write - - steps: - - name: Code Checkout - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.25.7" - - - name: Build release binaries - env: - CGO_ENABLED: 0 - REF: ${{ github.ref }} - run: | - GOARCH=amd64 go build -o dist/wings_linux_amd64 -v -trimpath -ldflags="-s -w -X github.com/exonical/wings/system.Version=${REF:11}" github.com/exonical/wings - chmod 755 dist/wings_linux_amd64 - GOARCH=arm64 go build -o dist/wings_linux_arm64 -v -trimpath -ldflags="-s -w -X github.com/exonical/wings/system.Version=${REF:11}" github.com/exonical/wings - chmod 755 dist/wings_linux_arm64 - - - name: Extract changelog - env: - REF: ${{ github.ref }} - run: | - sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" CHANGELOG.md > ./RELEASE_CHANGELOG - - - name: Create checksum and add to changelog - run: | - SUM=`cd dist && sha256sum wings_linux_amd64` - SUM2=`cd dist && sha256sum wings_linux_arm64` - echo -e "\n#### SHA256 Checksum\n\`\`\`\n$SUM\n$SUM2\n\`\`\`\n" >> ./RELEASE_CHANGELOG - echo -e "$SUM\n$SUM2" > checksums.txt - - - name: Create release branch - env: - REF: ${{ github.ref }} - run: | - BRANCH=release/${REF:10} - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git checkout -b ${BRANCH} - git push -u origin ${BRANCH} - sed -i "s/var Version = \".*\"/var Version = \"${REF:11}\"/" system/const.go - git add system/const.go - git commit -m "bump version for release" - git push - - - name: Create release - id: create_release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - draft: true - prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} - body_path: ./RELEASE_CHANGELOG - - - name: Upload amd64 binary - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/wings_linux_amd64 - asset_name: wings_linux_amd64 - asset_content_type: application/octet-stream - - - name: Upload arm64 binary - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/wings_linux_arm64 - asset_name: wings_linux_arm64 - asset_content_type: application/octet-stream - - - name: Upload checksum - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./checksums.txt - asset_name: checksums.txt - asset_content_type: text/plain diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 877c38ca..831f5ca3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,22 +19,23 @@ jobs: go-version-file: go.mod cache: true - - name: Build release binary + - name: Build release binaries env: CGO_ENABLED: 0 GOOS: linux - GOARCH: amd64 run: | VERSION="${GITHUB_REF_NAME#v}" - go build -v -trimpath \ - -ldflags="-s -w -X github.com/exonical/wings/system.Version=${VERSION}" \ - -o dist/wings_linux_amd64 \ - wings.go - chmod 755 dist/wings_linux_amd64 + for arch in amd64 arm64; do + GOARCH="${arch}" go build -v -trimpath \ + -ldflags="-s -w -X github.com/exonical/wings/system.Version=${VERSION}" \ + -o "dist/wings_linux_${arch}" \ + wings.go + chmod 755 "dist/wings_linux_${arch}" + done - name: Create checksums run: | - cd dist && sha256sum wings_linux_amd64 > checksums.txt + cd dist && sha256sum wings_linux_amd64 wings_linux_arm64 > checksums.txt - name: Create release uses: softprops/action-gh-release@v2 @@ -44,4 +45,5 @@ jobs: generate_release_notes: true files: | dist/wings_linux_amd64 + dist/wings_linux_arm64 dist/checksums.txt