github.com/MetalBlockchain/metalgo@v1.11.9/.github/workflows/build-macos-release.yml (about) 1 # Build a macos release from the metalgo repo 2 3 name: build-macos-release 4 5 # Controls when the action will run. 6 on: 7 workflow_dispatch: 8 inputs: 9 tag: 10 description: 'Tag to include in artifact name' 11 required: true 12 push: 13 tags: 14 - "*" 15 16 # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 jobs: 18 # This workflow contains a single job called "build" 19 build-mac: 20 # The type of runner that the job will run on 21 runs-on: macos-12 22 23 # Steps represent a sequence of tasks that will be executed as part of the job 24 steps: 25 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 - uses: actions/checkout@v4 27 - uses: ./.github/actions/setup-go-for-project 28 - run: go version 29 30 # Runs a single command using the runners shell 31 - name: Build the metalgo binary 32 run: ./scripts/build.sh 33 34 - name: Try to get tag from git 35 if: "${{ github.event.inputs.tag == '' }}" 36 id: get_tag_from_git 37 run: | 38 echo "TAG=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_ENV" 39 shell: bash 40 41 - name: Try to get tag from workflow dispatch 42 if: "${{ github.event.inputs.tag != '' }}" 43 id: get_tag_from_workflow 44 run: | 45 echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV" 46 shell: bash 47 48 - name: Create zip file 49 run: 7z a metalgo-macos-${TAG}.zip build/metalgo 50 env: 51 TAG: ${{ env.TAG }} 52 53 - name: Install aws cli 54 run: | 55 curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" 56 sudo installer -pkg AWSCLIV2.pkg -target / 57 58 - name: Configure AWS credentials 59 uses: aws-actions/configure-aws-credentials@v4 60 with: 61 aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} 62 aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 63 aws-region: us-east-1 64 65 - name: Upload file to S3 66 run: aws s3 cp metalgo-macos-${{ env.TAG }}.zip s3://${BUCKET}/macos/ 67 env: 68 BUCKET: ${{ secrets.BUCKET }} 69 70 - name: Save as Github artifact 71 uses: actions/upload-artifact@v4 72 with: 73 name: build 74 path: metalgo-macos-${{ env.TAG }}.zip 75 76 - name: Cleanup 77 run: | 78 rm -rf ./build