Skip to content

Commit

Permalink
Update CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Apr 21, 2018
1 parent 9835441 commit 493412d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
28 changes: 18 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,39 @@ variables:
GITHUB_REPO: linux-rootfs

VERSION: ${CI_COMMIT_TAG}
RELEASE_NAME: ${CI_COMMIT_TAG}
NAME: gitlab-ci-linux-rootfs-${CI_PIPELINE_ID}
BUILD_URL: $CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID
RELEASE_NAME: "${CI_COMMIT_TAG}: gitlab-ci-linux-rootfs-${CI_PIPELINE_ID}"
PIPELINE_URL: $CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID

stages: [prepare, build, pre-release, release]
stages: [draft, build, pre-release, release]

start_release:
stage: prepare
before_script:
- 'export CHANGES=$(git tag -l --format="%(contents)" "$CI_COMMIT_TAG")'
- 'export DESCRIPTION=$(echo -e "${CHANGES}\n\n${PIPELINE_URL}")'

draft:
stage: draft
only: [tags]
script:
- 'export CHANGES=$(git tag -l --format="%(contents)" "$CI_COMMIT_TAG")'
- 'github-release release --tag "${VERSION}" --name "$VERSION: $NAME" --description "$(echo -e "${CHANGES}\n\n${BUILD_URL}")" --draft'
- github-release release --tag "${VERSION}" --name "$RELEASE_NAME" --description "$DESCRIPTION" --target "$CI_COMMIT_SHA" --draft

pre-release:
stage: pre-release
only: [tags]
environment:
name: pre-release
url: https://github.com/$GITHUB_USER/$GITHUB_REPO/releases/tag/$CI_COMMIT_TAG
script:
- github-release release --tag "${VERSION}" --pre-release
- github-release edit --tag "${VERSION}" --name "$RELEASE_NAME" --description "$DESCRIPTION" --pre-release

release:
stage: release
only: [tags]
when: manual
environment:
name: release
url: https://github.com/$GITHUB_USER/$GITHUB_REPO/releases/tag/$CI_COMMIT_TAG
script:
- github-release release --tag "${VERSION}" --release
- github-release edit --tag "${VERSION}" --name "$RELEASE_NAME" --description "$DESCRIPTION" --pre-release

.build: &build
stage: build
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ node('docker && linux-build') {
environment.inside("--privileged -u 0:0") {
withEnv([
"USE_CCACHE=true",
"RELEASE_NAME=$VERSION",
"VERSION=$VERSION",
"RELEASE=$BUILD_NUMBER"
]) {
stage 'Images'
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export RELEASE_NAME ?= 0.1~dev
export VERSION ?= 0.1~dev

VARIANTS := $(patsubst configs/%,%,$(wildcard configs/*-*-*))

all: \
$(patsubst %,%-$(RELEASE_NAME)-armhf.tar.xz,$(VARIANTS)) \
$(patsubst %,%-$(RELEASE_NAME)-arm64.tar.xz,$(VARIANTS))
$(patsubst %,%-$(VERSION)-armhf.tar.xz,$(VARIANTS)) \
$(patsubst %,%-$(VERSION)-arm64.tar.xz,$(VARIANTS))

info:
@echo $(VARIANTS)
Expand All @@ -14,16 +14,16 @@ info:

%.tar:
bash build.sh "$@" \
"$(shell basename "$@" -$(RELEASE_NAME)-$(BUILD_ARCH).tar)" \
"$(shell basename "$@" -$(VERSION)-$(BUILD_ARCH).tar)" \
"$(BUILD_MODE)" \
"$(BUILD_SUITE)" \
"$(BUILD_ARCH)"

%-armhf.tar.xz: BUILD_ARCH=armhf
%-arm64.tar.xz: BUILD_ARCH=arm64

$(addsuffix -armhf, $(VARIANTS)): %-armhf: %-$(RELEASE_NAME)-armhf.tar.xz
$(addsuffix -arm64, $(VARIANTS)): %-arm64: %-$(RELEASE_NAME)-arm64.tar.xz
$(addsuffix -armhf, $(VARIANTS)): %-armhf: %-$(VERSION)-armhf.tar.xz
$(addsuffix -arm64, $(VARIANTS)): %-arm64: %-$(VERSION)-arm64.tar.xz

ubuntu-%.tar.xz: BUILD_MODE=ubuntu
ubuntu-xenial-%.tar.xz: BUILD_SUITE=xenial
Expand Down

0 comments on commit 493412d

Please sign in to comment.