Created
October 28, 2020 09:48
-
-
Save leohilbert/7c0436ea51691f18fefa4822c1067d4b to your computer and use it in GitHub Desktop.
delete gitlab-tag, create a new one, upload an artifact, create a new release and attach the artifact to it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upload_next: | |
stage: deploy | |
when: manual | |
except: | |
refs: | |
- next | |
only: | |
- master | |
needs: [ "package" ] | |
dependencies: [ "package" ] | |
image: registry.gitlab.com/gitlab-org/release-cli | |
variables: | |
GITLAB_URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST" | |
script: | |
- apk add curl zip jq | |
- (cd compiled && zip -rq ../next-$CI_COMMIT_SHORT_SHA.zip .) | |
- > | |
export UPLOAD_RESPONSE=$(curl --request POST -s -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" | |
--form "file=@next-$CI_COMMIT_SHORT_SHA.zip" | |
"$GITLAB_URL/api/v4/projects/$CI_PROJECT_ID/uploads") | |
- echo $UPLOAD_RESPONSE | |
- export PACKAGE_PATH=$(echo "$UPLOAD_RESPONSE" | jq -r '.full_path') | |
- > | |
curl --request DELETE -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" | |
"$GITLAB_URL/api/v4/projects/$CI_PROJECT_ID/repository/tags/next" | |
- echo "$GITLAB_URL$PACKAGE_PATH" | |
- > | |
release-cli create --name next --description next --tag-name next --ref $CI_COMMIT_SHA | |
--assets-link $(echo '{"name":"package","url":"'"$GITLAB_URL$PACKAGE_PATH"'","link_type":"package"}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because of https://gitlab.com/gitlab-org/gitlab/-/issues/24155 this is useless right now, but I wanted to persist it somewhere 😭
Once the API exists you could get the attached URL like this: