chore(ci): migrate CircleCI to GitHub Actions (#850)

This commit is contained in:
Teppei Fukuda
2021-02-22 06:56:17 +02:00
committed by GitHub
parent 9bc3565af1
commit e890ae02c2
4 changed files with 63 additions and 62 deletions

View File

@@ -1,52 +0,0 @@
version: 2.1
defaults: &defaults
docker :
- image: aquasec/trivy-ci:latest
environment:
CGO_ENABLED: "0"
jobs:
release:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
version: 19.03.13
- run:
name: login to Docker Hub
command: echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin
- run:
name: login to GitHub Container Registry
command: echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_USER --password-stdin
- run:
name: Release
command: goreleaser --rm-dist
- run:
name: Clone trivy repository
command: git clone git@github.com:aquasecurity/trivy-repo.git
- run:
name: Setup git settings
command: |
git config --global user.email "knqyf263@gmail.com"
git config --global user.name "Teppei Fukuda"
- run:
name: Create rpm repository
command: ci/deploy-rpm.sh
- run:
name: Import GPG key
command: echo -e "$GPG_KEY" | gpg --import
- run:
name: Create deb repository
command: ci/deploy-deb.sh
workflows:
version: 2
release:
jobs:
- release:
filters:
branches:
ignore: /.*/
tags:
only: /.*/

60
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Release
on:
push:
tags:
- "v*"
env:
GO_VERSION: "1.15"
GH_USER: "aqua-bot"
jobs:
release:
name: Release
runs-on: ubuntu-18.04 # 20.04 doesn't provide createrepo for now
steps:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install rpm reprepro createrepo distro-info
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout trivy-repo
uses: actions/checkout@v2
with:
repository: ${{ github.repository_owner }}/trivy-repo
path: trivy-repo
fetch-depth: 0
token: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: Login to docker.io registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ env.GH_USER }}
password: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: Release
uses: goreleaser/goreleaser-action@v2
with:
version: v0.156.2
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup git settings
run: |
git config --global user.email "knqyf263@gmail.com"
git config --global user.name "Teppei Fukuda"
- name: Create rpm repository
run: ci/deploy-rpm.sh
- name: Import GPG key
run: echo -e "${{ secrets.GPG_KEY }}" | gpg --import
- name: Create deb repository
run: ci/deploy-deb.sh

View File

@@ -1,10 +0,0 @@
FROM circleci/golang:1.15-buster
RUN sudo apt-get -y update \
&& sudo apt-get -y install rpm reprepro createrepo distro-info
ARG GORELEASER_VERSION=0.124.1
ARG GORELEASER_ARTIFACT=goreleaser_Linux_x86_64.tar.gz
RUN wget https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/${GORELEASER_ARTIFACT} \
&& sudo tar -xzf ${GORELEASER_ARTIFACT} -C /usr/bin/ goreleaser \
&& rm ${GORELEASER_ARTIFACT}

View File

@@ -25,6 +25,9 @@ builds:
ignore:
- goos: darwin
goarch: 386
# TODO: bump up Go to 1.16
- goos: darwin
goarch: arm64
nfpms:
-