diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2f47419 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: release image & asset + +on: + push: + tags: + - 'v*' + +jobs: + package: + runs-on: ubuntu-16.04 + steps: + - name: step0 + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + - name: step1 + run: go mod download && ./dist.sh + - name: step2 + uses: azure/docker-login@v1 + with: + login-server: registry.cn-hangzhou.aliyuncs.com + password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKER_USERNAME }} + - name: step3 + run: | + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \ + && docker build -t registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog . \ + && docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog \ + && docker tag registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog:${{ github.ref }} \ + && docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog:${{ github.ref }} + - name: step4 + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: step5 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: eiblog-${{ github.ref }}.darwin-amd64.tar.gz + asset_name: eiblog-${{ github.ref }}.darwin-amd64.tar.gz + asset_content_type: application/gzip + - name: step6 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: eiblog-${{ github.ref }}.linux-amd64.tar.gz + asset_name: eiblog-${{ github.ref }}.linux-amd64.tar.gz + asset_content_type: application/gzip + - name: step7 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: eiblog-${{ github.ref }}.windows-amd64.tar.gz + asset_name: eiblog-${{ github.ref }}.windows-amd64.tar.gz + asset_content_type: application/gzip