diff --git a/.github/workflows/call-release-chart.yaml b/.github/workflows/call-release-chart.yaml new file mode 100644 index 0000000..d253684 --- /dev/null +++ b/.github/workflows/call-release-chart.yaml @@ -0,0 +1,79 @@ +name: Call Release Charts + +env: + HELM_VERSION: v3.10.1 + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + workflow_dispatch: + inputs: + ref: + description: 'tag, sha, branch' + required: true + default: v1.0.0 + +permissions: write-all + +jobs: + chart-release: + name: Create Chart Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + steps: + - name: Get Original Ref + id: get_original_ref + run: | + if ${{ github.event_name == 'workflow_dispatch' }} ; then + echo "call by workflow_dispatch" + ver=${{ inputs.ref }} + echo "ref=${ver}" >> $GITHUB_OUTPUT + elif ${{ github.event_name == 'push' }} ; then + echo "call by push" + ver=${{ github.ref }} + echo "ref=${ver}" >> $GITHUB_OUTPUT + else + echo "unexpected event: ${{ github.event_name }}" + exit 1 + fi + + - name: Checkout + uses: actions/checkout@v2 + with: + # Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896 + fetch-depth: 0 + ref: ${{ needs.get_original_ref.outputs.ref }} + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Chart releaser + run: | + # Download chart releaser + curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.4.1/chart-releaser_1.4.1_linux_amd64.tar.gz" + tar -xzf cr.tar.gz + rm -f cr.tar.gz + repo=$(basename "$GITHUB_REPOSITORY") + owner=$(dirname "$GITHUB_REPOSITORY") + tag="${GITHUB_REF_NAME:1}" + echo "Creating release..." + # package chart + ./cr package charts/cilium-chaining + # upload chart to github releases + ./cr upload \ + --owner "$owner" \ + --git-repo "$repo" \ + --release-name-template "{{ .Name }}-chart-{{ .Version }}" \ + --token "${{ secrets.GITHUB_TOKEN }}" + # Update index and push to github pages + ./cr index \ + --owner "$owner" \ + --git-repo "$repo" \ + --index-path index.yaml \ + --release-name-template "{{ .Name }}-chart-{{ .Version }}" \ + --push diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 098e0ed..92c8ca7 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -26,8 +26,8 @@ jobs: if ${{ github.event_name == 'push' }} ; then echo "trigger by push" echo ::set-output name=tag::${{ github.sha }} - elif ${{ github.event_name == 'pull_request_target' }} ; then - echo "trigger by pull_request_target" + elif ${{ github.event_name == 'pull_request' }} ; then + echo "trigger by pull_request" echo ::set-output name=tag::${{ github.event.pull_request.head.sha }} else echo "unexpected event: ${{ github.event_name }} "