From a72f476f1c3fa28f4d187ff33115b955b6eab469 Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Fri, 4 Apr 2025 12:42:54 +0200 Subject: [PATCH] chore(ci): tag patching Signed-off-by: rjshrjndrn --- .github/workflows/patch-build-old.yaml | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/patch-build-old.yaml diff --git a/.github/workflows/patch-build-old.yaml b/.github/workflows/patch-build-old.yaml new file mode 100644 index 000000000..ea3d224be --- /dev/null +++ b/.github/workflows/patch-build-old.yaml @@ -0,0 +1,42 @@ +# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions + +on: + workflow_dispatch: + inputs: + services: + description: 'Comma separated names of services to build(in small letters).' + required: true + default: 'chalice,frontend' + tag: + description: 'Tag to build patches from.' + required: true + type: string + +name: Build patches from tag, rewrite commit HEAD to older timestamp, and Push the tag + +jobs: + deploy: + name: Build Patch from old tag + runs-on: ubuntu-latest + env: + DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }} + DEPOT_PROJECT_ID: ${{ secrets.DEPOT_PROJECT_ID }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + ref: ${{ github.event.inputs.tag }} + + - name: Create backup tag with timestamp + run: | + set -e # Exit immediately if a command exits with a non-zero status + TIMESTAMP=$(date +%Y%m%d%H%M%S) + BACKUP_TAG="${{ github.event.inputs.tag }}-backup-${TIMESTAMP}" + echo "BACKUP_TAG=${BACKUP_TAG}" >> $GITHUB_ENV + git tag $BACKUP_TAG || { echo "Failed to create backup tag"; exit 1; } + git push origin $BACKUP_TAG || { echo "Failed to push backup tag"; exit 1; } + echo "Created backup tag: $BACKUP_TAG" + + - name: Setup yq + uses: mikefarah/yq@master