Skip to content

Initial commit

Initial commit #1

Workflow file for this run

on:
push:
branches:
- main
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- id: release
uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: norelease
- name: Check output Parameters
run: |
echo "Got tag name ${{ steps.release.outputs.tag_name }}"
echo "Got release version ${{ steps.release.outputs.version }}"
echo "Upload release artifacts to ${{ steps.release.outputs.upload_url }}"
- name: Create Alias Tag
uses: actions/github-script@v7
with:
script: |
const owner = core.getInput('owner')
const repo = core.getInput('repo').split('/')[1]
const version = core.getInput('version')
console.log('context', JSON.stringify(context, null , 2))
const getMajorVersionAlias = (version)=>{
return version.split('.')[0]
};
const existsMajorVersion = async (params) => {
return ( await github.rest.git.listMatchingRefs(params) )
.data
.filter(tag=>{
return tag.ref == `refs/${params.ref}`
})
.length==1
}
const majorVersion = getMajorVersionAlias(core.getInput('version'))
const versionParams = {
ref: `tags/${majorVersion}`,
owner,
repo
}
console.log('Major Version')
console.log(majorVersion)
const alreadyExists = await existsMajorVersion(versionParams)
if (alreadyExists){
console.log('already exists')
github.rest.git.updateRef({
owner,
repo,
ref:`refs/tags/${majorVersion}`,
sha:context.sha,
force: true
});
}
else{
console.log('create new tag alias')
github.rest.git.createRef({
owner,
repo,
ref:`refs/tags/${majorVersion}`,
sha:context.sha,
});
}
version: ${{ steps.release.outputs.version }}
owner: ${{ github.repository_owner }}
repo: ${{ github.repository }}