From 17179f83b9e5bcc3eea385f6f92d192ea27cef5a Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Mon, 14 Nov 2022 09:41:58 +0800 Subject: [PATCH] add release ci. Signed-off-by: Jared Tan --- .github/workflows/release-package.yaml | 106 +++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .github/workflows/release-package.yaml diff --git a/.github/workflows/release-package.yaml b/.github/workflows/release-package.yaml new file mode 100644 index 0000000000000..ee4fbd42fbaf3 --- /dev/null +++ b/.github/workflows/release-package.yaml @@ -0,0 +1,106 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: release-packages + +on: + push: + branches: + - main + - insight-main + tags: ["v*"] + pull_request: + branches: + - main + - insight-main + +env: + # Use docker.io for Docker Hub if empty + REGISTRY_SERVER_ADDRESS: ghcr.io/openinsight-proj + REGISTRY_USER_NAME: ${{ github.repository_owner }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_TOKEN }} + +jobs: + setup-environment: + timeout-minutes: 30 + runs-on: ubuntu-latest + if: ${{ github.actor != 'dependabot[bot]' }} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - name: Cache Go + id: go-cache + uses: actions/cache@v3 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Install dependencies + if: steps.go-cache.outputs.cache-hit != 'true' + run: make -j2 gomoddownload + - name: Install Tools + if: steps.go-cache.outputs.cache-hit != 'true' + run: make install-tools + release-images: + if: github.repository == 'openinsight-proj/opentelemetry-collector-contrib' + runs-on: ubuntu-latest + needs: [setup-environment] + permissions: + contents: read + packages: write + timeout-minutes: 90 + env: + TAG: ${{ github.sha }} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - name: Cache Go + id: go-cache + uses: actions/cache@v3 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Install dependencies + if: steps.go-cache.outputs.cache-hit != 'true' + run: make -j2 gomoddownload + - name: Install Tools + if: steps.go-cache.outputs.cache-hit != 'true' + run: make install-tools + - name: Login to GitHub Package Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.ACTIONS_TOKEN }} + - name: Build otel col contrib + run: GOOS=linux GOARCH=amd64 make otelcontribcol && cp ./bin/otelcontribcol_linux_amd64 ./cmd/otelcontribcol/otelcontribcol + - name: Push otel col contrib to Github packages + uses: docker/build-push-action@v3 + with: + context: cmd/otelcontribcol + push: true + tags: ${{ env.REGISTRY_SERVER_ADDRESS }}/opentelemetry-collector-contrib:${{ env.TAG }} \ No newline at end of file