|
| 1 | +### This builds, packages, signs, performs AV and malware scanning, and |
| 2 | +### creates a new GitHub release for the newest version of go-getter. |
| 3 | +### The GitHub release step performs the actions outlined in |
| 4 | +### release.goreleaser.yml. A release is triggered when a new tag |
| 5 | +### is pushed in the format vX.X.X |
| 6 | + |
| 7 | +name: Release |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + tags: |
| 12 | + - 'v[0-9]+.[0-9]+.[0-9]+*' |
| 13 | + |
| 14 | +jobs: |
| 15 | + release: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + - name: Setup go |
| 23 | + uses: actions/setup-go@v2 |
| 24 | + with: |
| 25 | + go-version: '^1.15' |
| 26 | + - name: Install hc-codesign |
| 27 | + id: codesign |
| 28 | + run: | |
| 29 | + docker login docker.pkg.github.com -u docker -p $GITHUB_TOKEN && \ |
| 30 | + docker pull docker.pkg.github.com/hashicorp/hc-codesign/hc-codesign:$VERSION && \ |
| 31 | + echo "::set-output name=image::docker.pkg.github.com/hashicorp/hc-codesign/hc-codesign:$VERSION" |
| 32 | + env: |
| 33 | + VERSION: v0 |
| 34 | + GITHUB_TOKEN: ${{ secrets.CODESIGN_GITHUB_TOKEN }} |
| 35 | + - name: Install wget & clamAV antivirus scanner |
| 36 | + run : | |
| 37 | + sudo apt-get -qq install -y ca-certificates wget clamav |
| 38 | + wget --version |
| 39 | + - name: Install maldet malware scanner |
| 40 | + run: | |
| 41 | + wget --no-verbose -O maldet-$VERSION.tar.gz https://github.com/rfxn/linux-malware-detect/archive/$VERSION.tar.gz |
| 42 | + sha256sum -c - <<< "$SHA256SUM maldet-$VERSION.tar.gz" |
| 43 | + sudo mkdir -p maldet-$VERSION |
| 44 | + sudo tar -xzf maldet-$VERSION.tar.gz --strip-components=1 -C maldet-$VERSION |
| 45 | + cd maldet-$VERSION |
| 46 | + sudo ./install.sh |
| 47 | + sudo maldet -u |
| 48 | + env: |
| 49 | + VERSION: 1.6.4 |
| 50 | + SHA256SUM: 3ad66eebd443d32dd6c811dcf2d264b78678c75ed1d40c15434180d4453e60d2 |
| 51 | + - name: Import PGP key for archive signing |
| 52 | + run: echo -e $PGP_KEY | base64 -di | gpg --import --batch |
| 53 | + env: |
| 54 | + GPG_TTY: $(tty) |
| 55 | + PGP_KEY: ${{ secrets.PGP_SIGNING_KEY }} |
| 56 | + - name: GitHub Release |
| 57 | + uses: goreleaser/goreleaser-action@v1 |
| 58 | + with: |
| 59 | + version: latest |
| 60 | + args: release --skip-validate --timeout "60m" |
| 61 | + env: |
| 62 | + PGP_KEY_ID: ${{ secrets.PGP_KEY_ID }} |
| 63 | + CODESIGN_IMAGE: ${{ steps.codesign.outputs.image }} |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} |
| 66 | + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} |
| 67 | + CIRCLE_TOKEN: ${{ secrets.CIRCLE_TOKEN }} |
| 68 | + - name: Run clamAV antivirus scanner |
| 69 | + run: sudo clamscan /home/runner/work/$REPO/$REPO/dist/ |
| 70 | + env: |
| 71 | + REPO: ${{ github.event.repository.name }} |
| 72 | + - name: Run maldet malware scanner |
| 73 | + run: sudo maldet -a /home/runner/work/$REPO/$REPO/dist/ |
| 74 | + env: |
| 75 | + REPO: ${{ github.event.repository.name }} |
| 76 | + |
0 commit comments