Skip to content

chore(main): release actions/jfrog-upload 0.2.6 (#16) #61

chore(main): release actions/jfrog-upload 0.2.6 (#16)

chore(main): release actions/jfrog-upload 0.2.6 (#16) #61

Workflow file for this run

on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: "Release new actions"
jobs:
changelist:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Additional checkout
run: |
git fetch --no-tags --depth 100 origin "+refs/heads/main:refs/remotes/origin/main"
- name: Get actions changelist
id: changelist
run: |
CHANGELIST=$(git diff --name-only HEAD^ HEAD | grep -v ".github/workflows" | awk -F'/' 'NF > 2 { print $1"/"$2 }' | awk '{ printf "\"%s\",\n", $0 }' | sort | uniq | tr '\n' ' ' | sed s/..$//g)
if [ -z "$CHANGELIST" ]
then
echo "changed_actions=nulll"
else
echo "changed_actions=${CHANGELIST}"
echo "changed_actions={\"component\": [$(echo ${CHANGELIST})]}" >> $GITHUB_OUTPUT
fi
outputs:
changed_actions: ${{ steps.changelist.outputs.changed_actions }}
release:
if: ${{ needs.changelist.outputs.changed_actions != '[]' && needs.changelist.outputs.changed_actions != '' }}
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs:
- changelist
strategy:
fail-fast: false
matrix: ${{fromJson(needs.changelist.outputs.changed_actions)}}
steps:
- name: "[CI] Get Github Token based on Github App authentication"
id: ghapp-cybersecurity-ci
uses: getsentry/action-github-app-token@v3
with:
app_id: ${{ secrets.CYBERSECURITY_CI_APP_ID }}
private_key: ${{ secrets.CYBERSECURITY_CI_APP_PRIVATE_KEY }}
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ steps.ghapp-cybersecurity-ci.outputs.token }}
release-type: terraform-module
package-name: ${{ matrix.component }}
monorepo-tags: true
path: ${{ matrix.component }}
include-v-in-tag: false
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
# - run: |
# echo "${{ steps.release.outputs.major }}"
# echo "${{ steps.release.outputs.minor }}"
# echo "${{ steps.release.outputs.patch }}"
# echo "${{ steps.release.outputs.releases_created }}"
# echo "${{ steps.release.outputs.tag_name }}"
# echo "${{ steps.release.outputs.paths_released }}"
# echo "${{ steps.release.outputs.paths_released[0] }}"
# path_release="${{ steps.release.outputs.paths_released[0] }}"
# path_clean=$(echo $paths_released | jq -r '.[0]')
# echo $path_clean
# tag_name_key="${path_clean}--tag_name"
# tag_name=$(eval echo "\${{ steps.previous_step.outputs.$tag_name_key }}")
# echo "tag_name"
- name: "[Release] Checkout code"
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@v4
- name: "[Release] Update Major tags"
uses: actions/github-script@v7
if: ${{ steps.release.outputs.releases_created }}
with:
github-token: ${{ steps.ghapp-cybersecurity-ci.outputs.token }}
script: |
// Major
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ matrix.component }}-v${{ steps.release.outputs.major }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ matrix.component }}-v${{ steps.release.outputs.major }}',
sha: context.sha
});
})
// Minor
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ matrix.component }}-v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ matrix.component }}-v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}',
sha: context.sha
});
})