Skip to content

Using password manager's SSH_AUTH_SOCK on MacOS if it's used #134

Using password manager's SSH_AUTH_SOCK on MacOS if it's used

Using password manager's SSH_AUTH_SOCK on MacOS if it's used #134

Workflow file for this run

---
name: Build, tag and release
permissions:
contents: write
packages: write
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_image:
runs-on: ubuntu-latest
steps:
- name: Pulling Catapult repository...
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Logging into to GitHub Container Registry...
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Installing QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0
- name: Getting current version...
run: |
VERSION=$(cat version.yml | cut -d ' ' -f 2)
echo "IMAGE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Building Catapult image...
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
VERSION=${{ env.IMAGE_VERSION }}
push: true
annotations: |
org.opencontainers.image.description=Pre-built Docker image for Catapult
org.opencontainers.image.licenses=AGPL-3.0 license
org.opencontainers.image.source=https://github.com/ClarifiedSecurity/catapult
tags: |
ghcr.io/clarifiedsecurity/catapult:latest
ghcr.io/clarifiedsecurity/catapult:main
ghcr.io/clarifiedsecurity/catapult:${{ env.IMAGE_VERSION }}
ghcr.io/clarifiedsecurity/catapult:v${{ env.IMAGE_VERSION }}
tag_and_release:
needs: build_image
runs-on: ubuntu-latest
steps:
- name: Cloning the repository repo...
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
fetch-tags: true
- name: Creating a tag and a release
run: |
VERSION_FILE="version.yml"
VERSION=$(cat $VERSION_FILE | grep "version:" | cut -d " " -f 2)
CURRENT_TAG=$(git tag --sort=-creatordate | head -n 1)
NEW_TAG="v$VERSION"
# Tagging and pushing the change
git tag $NEW_TAG
git push origin $NEW_TAG
# Creating temp changelog file
echo "Getting commits between the current tag $CURRENT_TAG and the new tag $NEW_TAG"
git log $CURRENT_TAG..$NEW_TAG --pretty=format:"- %s" > CHANGELOG.md
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-d "{
\"name\": \"$NEW_TAG\",
\"tag_name\": \"$NEW_TAG\",
\"body\": $(jq -sR . < CHANGELOG.md)
}"