Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sinologie 2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kartenaale
Anki Packs
Sinologie 2
Commits
59a383e0
Commit
59a383e0
authored
11 months ago
by
Philipp Stadler
Browse files
Options
Downloads
Patches
Plain Diff
chore: add automatic releases
parent
e0f2c9c2
No related branches found
No related tags found
1 merge request
!2
chore: add automatic releases
Pipeline
#13833
passed
11 months ago
Stage: build
Stage: release
Changes
2
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+53
-0
53 additions, 0 deletions
.gitlab-ci.yml
package.json
+3
-0
3 additions, 0 deletions
package.json
with
56 additions
and
0 deletions
.gitlab-ci.yml
+
53
−
0
View file @
59a383e0
...
...
@@ -2,6 +2,7 @@ image: durcheinander/export-apkgs:1.0.0
stages
:
-
build
-
release
build
:
stage
:
build
...
...
@@ -13,6 +14,58 @@ build:
script
:
-
curl https://gitlab.phaidra.org/kartenaale/card-templates/-/jobs/104428/artifacts/raw/card-templates-1.0.2.tar.gz | tar -xz
-
export_apkgs -c content -t templates -o .
-
echo "ARTIFACTS_URL=https://gitlab.phaidra.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/browse" > build.env
artifacts
:
paths
:
-
'
*.apkg'
reports
:
dotenv
:
build.env
release-package-json-version-as-git-tag
:
stage
:
release
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "schedule"
when
:
never
# tagging should only happen after the thing was merged, so do it on the main branch build
-
if
:
$CI_COMMIT_BRANCH == "main"
# we don't need anything in node_modules or python, so don't fetch the cache
cache
:
[]
script
:
-
NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4)
# || exit_code=$? is the recommended way to ignore a non-zero exit code
-
NPM_VERSION_GIT_TAG=$(git tag | grep ^${NPM_VERSION}$ || exit_code=$?)
-
if [ -z "$NPM_VERSION_GIT_TAG" ]; then
-
echo adding git tag for first commit on main with NPM version ${NPM_VERSION}
-
git remote remove origin
-
git remote add origin https://oauth:${REPOSITORY_ACCESS_TOKEN}@gitlab.phaidra.org/$CI_PROJECT_PATH.git
-
git config user.email Cao Cao
-
git config user.name cao.cao@ci.kartenaale
-
git tag -a $NPM_VERSION -m "Release $NPM_VERSION"
-
git push origin $NPM_VERSION
-
else
-
'
echo
package-json-tag:
keeping
older
tag
for
$NPM_VERSION'
-
fi
create-gitlab-release
:
image
:
registry.gitlab.com/gitlab-org/release-cli:latest
stage
:
release
rules
:
-
if
:
$CI_COMMIT_TAG
needs
:
-
job
:
build
artifacts
:
true
variables
:
# we just need the artifacts and don't need up-to-date source, so don't even fetch
GIT_STRATEGY
:
none
# we don't need anything in node_modules or python, so don't fetch the cache
cache
:
[]
script
:
-
echo Creating GitLab release…
release
:
tag_name
:
'
$CI_COMMIT_TAG'
name
:
'
$CI_COMMIT_TAG'
description
:
'
Neue
APKGS
stehen
zum
Download
bereit.'
assets
:
links
:
-
name
:
'
Browse
all
APKGS…'
url
:
'
$ARTIFACTS_URL'
This diff is collapsed.
Click to expand it.
package.json
0 → 100644
+
3
−
0
View file @
59a383e0
{
"version"
:
"1.0.0"
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment