diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..c044025 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,54 @@ +name: build image + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: jupiterone/graph-kubernetes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3c6a17..7ffe675 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,21 +1,26 @@ -name: Build -on: [push, pull_request] +name: build + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + pull_request: + branches: + - main jobs: test: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - node-version: [14.x] - os: [ubuntu-latest, macos-latest] - steps: - id: setup-node name: Setup Node uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 14.x - name: Check out code repository source code uses: actions/checkout@v2 @@ -31,10 +36,10 @@ jobs: # Publishing is done in a separate job to allow # for all matrix builds to complete. - release: + release-npm: needs: test runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/main' strategy: fail-fast: false matrix: diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index 97b3280..3dcfbc3 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -1,11 +1,21 @@ name: gitleaks -on: [push, pull_request] +on: + push: + branches: + - main + tags: + - 'v*.*.*' + pull_request: + branches: + - main jobs: gitleaks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Check out code repository source code + uses: actions/checkout@v2 + - name: gitleaks-action uses: zricethezav/gitleaks-action@master