github.com/core-coin/go-core/v2@v2.1.9/.github/workflows/build.yml (about)

     1  name: go-core build
     2  on: push
     3  jobs:
     4    build:
     5      strategy:
     6        matrix:
     7          platform: [
     8            {os: ubuntu-latest, path: linux-x86_64},
     9            {os: windows-latest, path: windows-x86_64},
    10            {os: raspbian-private, path: linux-arm64},
    11            {os: macos-latest, path: darwin-x86_64},
    12          ]
    13      runs-on: ${{ matrix.platform.os }}
    14      steps:
    15      - name: Checkout
    16        uses: actions/checkout@v3
    17      - name: Setup Go
    18        uses: actions/setup-go@v2
    19        with:
    20          go-version: 1.21.x
    21      - name: Setup MSYS
    22        if: ${{ matrix.platform.os == 'windows-latest' }}
    23        uses: msys2/setup-msys2@v2
    24        with:
    25          msystem: mingw64
    26          update: true
    27          install: >
    28            git
    29            base-devel
    30            autoconf-wrapper
    31            autoconf
    32            automake
    33            libtool
    34            mingw-w64-x86_64-toolchain
    35            mingw-w64-x86_64-go
    36      - name: Build Windows
    37        if: ${{ matrix.platform.os == 'windows-latest' }}
    38        shell: msys2 {0}
    39        run: |
    40          make gocore
    41          make test
    42      - name: Build
    43        if: ${{ matrix.platform.os != 'windows-latest' }}
    44        run: | 
    45          make gocore
    46          make test
    47      - name: Upload Gocore
    48        if: startsWith(github.ref, 'refs/tags/v')
    49        uses: actions/upload-artifact@v2
    50        with:
    51          name: gocore-${{ matrix.platform.path }}
    52          path: ./build/bin/gocore*
    53    release:
    54      if: startsWith(github.ref, 'refs/tags/v')
    55      needs: build
    56      runs-on: ubuntu-latest
    57      outputs:
    58        upload_url: ${{ steps.create_release.outputs.upload_url }}
    59      steps:
    60      - name: Checkout
    61        uses: actions/checkout@v3
    62      - name: Version
    63        id: version
    64        run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
    65      - name: Release
    66        id: create_release
    67        uses: actions/create-release@v1
    68        env:
    69          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    70        with:
    71          tag_name: ${{ steps.version.outputs.tag }}
    72          release_name: ${{ steps.version.outputs.tag }} gocore release
    73          draft: false
    74          prerelease: true
    75    artifacts:
    76      needs: release
    77      runs-on: ubuntu-latest
    78      strategy:
    79        matrix:
    80          platform: [
    81            {path: linux-x86_64, file_ext: ""},
    82            {path: windows-x86_64, file_ext: ".exe"},
    83            {path: linux-arm64, file_ext: ""},
    84            {path: darwin-x86_64, file_ext: ""},
    85          ]
    86      steps:
    87      - name: Checkout
    88        uses: actions/checkout@v3
    89      - name: Artifact Gocore
    90        uses: actions/download-artifact@v2
    91        with:
    92          name: gocore-${{ matrix.platform.path}}
    93          path: ./gocore-${{ matrix.platform.path }}
    94      - name: Upload Gocore release assets
    95        uses: actions/upload-release-asset@v1
    96        env:
    97          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    98        with:
    99          upload_url: ${{ needs.release.outputs.upload_url }}
   100          asset_path: ./gocore-${{ matrix.platform.path }}/gocore${{matrix.platform.file_ext}}
   101          asset_name: gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}
   102          asset_content_type: application/octet-stream
   103      - name: Generate gocore checksums
   104        working-directory: ./gocore-${{ matrix.platform.path }}
   105        run: |
   106          mv ./gocore${{matrix.platform.file_ext}} ./gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}
   107          sha256sum gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}} >gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
   108      - name: Upload Gocore release assets checksums (Linux and Mac)
   109        uses: actions/upload-release-asset@v1
   110        env:
   111          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   112        with:
   113          upload_url: ${{ needs.release.outputs.upload_url }}
   114          asset_path: ./gocore-${{ matrix.platform.path }}/gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
   115          asset_name: gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
   116          asset_content_type: text/plain