Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: cicd release failing with HTTP 404 error #1188

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,45 +103,59 @@ jobs:
with:
github-token: ${{ secrets.MOVE2KUBE_PATOKEN }}
script: |
core.info('DEBUG 1 start');
const tag = '${{ github.event.inputs.tag }}';
const sha = '${{ steps.get_sha.outputs.sha }}';
core.info(`DEBUG 2 tag ${tag} sha ${sha}`);

let tag_exists = false;
try {
core.info('DEBUG 3 try checking if the tag exists');
const resp = await github.git.getRef({...context.repo, ref: `tags/${tag}`});
tag_exists = true;
core.info(`the tag ${tag} already exists on ${resp.data.object.type} ${resp.data.object.sha}`);
} catch(err) {
core.info('DEBUG 4 an error occurred while checking if the tag exists');
core.info(`DEBUG 5 err.status ${err.status}`);
if(err.status !== 404){
throw err;
}
core.info('DEBUG 6 the tag does not exist');
}
core.info('DEBUG 7 after checking if the tag exists');
if(tag_exists) {
core.info('DEBUG 8 the tag exists');
core.info(`deleting the tag ${tag}`);
const resp = await github.git.deleteRef({...context.repo, ref: `tags/${tag}`});
core.info('DEBUG 9 after deleting the existing tag');
}

core.info('DEBUG 10');
core.info(`creating the tag ${tag} on the commit ${sha}`);
github.git.createRef({
...context.repo,
ref: `refs/tags/${tag}`,
sha
});
core.info('DEBUG 11 after creating the tag');
if(!tag.endsWith('-beta.0')) {
core.info('DEBUG 12 the tag does not end with -beta.0');
return;
}
core.info('DEBUG 13 the tag ends with -beta.0 so create a new release branch');
// create the release branch
const major_minor = /^v(\d+\.\d+)/.exec(tag);
if(!major_minor || major_minor.length !== 2){
return core.setFailed(`The tag is not a valid semantic version. tag: ${tag}`);
}
core.info('DEBUG 14 creating the new release branch');
const branch_name = `release-${major_minor[1]}`;
core.info(`New beta.0 release. Creating new branch for ${branch_name}`);
github.git.createRef({
...context.repo,
ref: `refs/heads/${branch_name}`,
sha
});
core.info('DEBUG 15 after creating the new release branch');

create_release_draft:
needs: [tag]
Expand Down
Loading