1name: Release YQ 2on: 3 push: 4 tags: 5 - 'v*' 6 7jobs: 8 publishGitRelease: 9 runs-on: ubuntu-latest 10 steps: 11 - uses: actions/checkout@v2 12 - uses: actions/setup-go@v2 13 with: 14 go-version: '^1.15' 15 - name: Cross compile 16 run: | 17 sudo apt-get install rhash -y 18 go get github.com/mitchellh/gox 19 ./scripts/xcompile.sh 20 21 - name: Create Release 22 id: create_release 23 uses: actions/create-release@v1.0.0 24 env: 25 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 with: 27 tag_name: ${{ github.ref }} 28 release_name: ${{ github.ref }} 29 draft: true 30 prerelease: false 31 32 - uses: shogo82148/actions-upload-release-asset@v1 33 with: 34 upload_url: ${{ steps.create_release.outputs.upload_url }} 35 asset_path: build/* 36 37 publishDocker: 38 environment: dockerhub 39 env: 40 IMAGE_NAME: mikefarah/yq 41 runs-on: ubuntu-latest 42 steps: 43 - uses: actions/checkout@v2 44 45 - name: Set up QEMU 46 uses: docker/setup-qemu-action@v1 47 with: 48 platforms: all 49 50 - name: Set up Docker Buildx 51 id: buildx 52 uses: docker/setup-buildx-action@v1 53 with: 54 version: latest 55 56 - name: Available platforms 57 run: echo ${{ steps.buildx.outputs.platforms }} && docker version 58 59 - name: Build and push image 60 run: | 61 IMAGE_V_VERSION="$(git describe --tags --abbrev=0)" 62 IMAGE_VERSION=${IMAGE_V_VERSION:1} 63 64 SHORT_SHA1=$(git rev-parse --short HEAD) 65 PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64" 66 echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}" 67 echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin 68 docker buildx build --platform "${PLATFORMS}" -t "${IMAGE_NAME}:${IMAGE_VERSION}" -t "${IMAGE_NAME}:latest" -t "${IMAGE_NAME}:4" \ 69 --push . 70 71