当前位置:   article > 正文

GitHub Actions 持续集成 - 2. 将工程打包并上传至 Release_github action java 发布到releaser

github action java 发布到releaser

GitHub Actions 持续集成 - 2. 将工程打包并上传至 Release

本文地址:blog.lucien.ink/archives/493

0. 摘要

之前挖了一个,慢慢补上。

上篇文章介绍了如何自动生成 Release 的内容,本文章旨在介绍如何借助 GitHub Actions 在 Release 时自动上传打包好的工程。

1. 现成的轮子

使用此 Action 可以将特定的文件上传至 release 中。

github.com/JasonEtco/upload-to-release

2. GitHub Actions YML 文件

.github/workflows/upload-to-release.yml

name: Go Release

on:
  release:
    types: [published]

jobs:

  release:
    if: github.repository == 'PasteUs/HelloCI'
    name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }} and upload
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        go_version: [1.13]
        os: [ubuntu-latest]

    steps:

      - name: Set up Go ${{ matrix.go_version }}
        uses: actions/setup-go@v1
        with:
          go-version: ${{ matrix.go_version }}
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v1

      - name: Get dependencies
        run: |
          go get -v -t -d ./...
          if [ -f Gopkg.toml ]; then
              curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
              dep ensure
          fi

      - name: Build
        run: |
          go build -v -o main .

      - name: Gzip
        run: |
          mkdir hello-word-${{ matrix.os }}
          cp main hello-word-${{ matrix.os }}
          tar -czvf hello-word-${{ matrix.os }}.tar.gz hello-word-${{ matrix.os }}

      - name: Upload to release
        uses: JasonEtco/upload-to-release@master
        with:
          args: hello-word-${{ matrix.os }}.tar.gz application/octet-stream
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/69223
推荐阅读
相关标签
  

闽ICP备14008679号