|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - 'v*' |
| 5 | + |
| 6 | +name: Release |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + |
| 14 | + - name: Set up Go 1.14.2 |
| 15 | + uses: actions/setup-go@v1 |
| 16 | + with: |
| 17 | + go-version: 1.14.2 |
| 18 | + id: go |
| 19 | + |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@master |
| 22 | + |
| 23 | + - name: build linux |
| 24 | + run: GOOS=linux go build -a -v -installsuffix cgo -ldflags="-w -s" -o gitlab-system-hooks-linux . |
| 25 | + |
| 26 | + - name: build darwin |
| 27 | + run: GOOS=darwin go build -a -v -installsuffix cgo -ldflags="-w -s" -o gitlab-system-hooks-darwin . |
| 28 | + |
| 29 | + - name: Create Release |
| 30 | + id: create_release |
| 31 | + uses: actions/create-release@v1.0.0 |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + with: |
| 35 | + tag_name: ${{ github.ref }} |
| 36 | + release_name: Release ${{ github.ref }} |
| 37 | + draft: false |
| 38 | + prerelease: false |
| 39 | + |
| 40 | + - name: save linux artifact in Actions |
| 41 | + uses: actions/upload-artifact@v1.0.0 |
| 42 | + with: |
| 43 | + name: linux |
| 44 | + path: gitlab-system-hooks-linux |
| 45 | + |
| 46 | + - name: save darwin artifact in Actions |
| 47 | + uses: actions/upload-artifact@v1.0.0 |
| 48 | + with: |
| 49 | + name: darwin |
| 50 | + path: gitlab-system-hooks-darwin |
| 51 | + |
| 52 | + - name: upload linux release asset |
| 53 | + uses: actions/upload-release-asset@v1.0.1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + with: |
| 57 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 58 | + asset_path: ./gitlab-system-hooks-linux |
| 59 | + asset_name: gitlab-system-hooks-linux |
| 60 | + asset_content_type: application/binary |
| 61 | + |
| 62 | + - name: upload darwin release asset |
| 63 | + uses: actions/upload-release-asset@v1.0.1 |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + with: |
| 67 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 68 | + asset_path: ./gitlab-system-hooks-darwin |
| 69 | + asset_name: gitlab-system-hooks-darwin |
| 70 | + asset_content_type: application/binary |
| 71 | + |
0 commit comments