Release Sygma OTEL Collector - by @eedygreen #108
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OpenTelemetry | |
on: | |
# release: | |
# types: | |
# - published | |
push: | |
branches: | |
- cosign | |
run-name: Release Sygma OTEL Collector - ${{ inputs.release_tag }} by @${{ github.actor }} | |
env: | |
REGISTRY: 'ghcr.io' | |
# TAG: 'latest' | |
TAG_LATEST: 'cosign' | |
TAG_BRANCH: 'test' | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
jobs: | |
push: | |
name: publish image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
environment: prod | |
steps: | |
- name: removed untaged package | |
uses: minish144/delete-untagged-action@v2 | |
with: | |
github-token: ${{ secrets.GHCR_TOKEN }} | |
- name: Authorised User only | |
run: | | |
if [[ ! " eedygreen mpetrunic MakMuftic akchainsafe " =~ " ${{ github.actor }} " ]]; then | |
echo "You are not authorized to release!" | |
exit 1 | |
fi | |
- name: Install Cosign | |
uses: sigstore/[email protected] | |
- name: checkout the source code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: login to ghcr | |
id: ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: build, tag & push docker image into ghcr | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.GITHUB_REPOSITORY }}:${{ env.TAG_LATEST }},${{ env.REGISTRY }}/${{ env.GITHUB_REPOSITORY }}:${{ env.TAG_BRANCH }} | |
- name: Obatin OIDC TOKEN | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_TESTNET }}:role/github-actions-TESTNET-chainbridge | |
aws-region: ${{ secrets.AWS_REGION }} | |
role-session-name: GithubActions | |
- name: Image Signing | |
env: | |
DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
run: | | |
cosign sign --yes $REGISTRY/$GITHUB_REPOSITORY@${DIGEST} | |
- name: Verify Image | |
env: | |
DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
run: | | |
cosign verify $REGISTRY/$GITHUB_REPOSITORY@${DIGEST}\ | |
--certificate-identity-regexp "${GITHUB_ACTOR}@users.noreply.github.com"\ | |
--certificate-oidc-issuer "token.actions.githubusercontent.com" | |
- name: slack notify | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,action,job,eventName,ref,workflow | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: always() |