1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

Release go-binary via piper action (#1243)

This commit is contained in:
Florian Wilhelm 2020-03-11 16:58:56 +01:00 committed by GitHub
parent 922a1796e0
commit 4e9b7f6cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 14 deletions

27
.github/workflows/release-go-master.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Publish master branch binary
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
- env:
CGO_ENABLED: 0
run: |
go build -ldflags "-X github.com/SAP/jenkins-library/cmd.GitCommit=${GITHUB_SHA} \
-X github.com/SAP/jenkins-library/pkg/log.LibraryRepository=${GITHUB_REPOSITORY} \
-X github.com/SAP/jenkins-library/pkg/telemetry.LibraryRepository=${GITHUB_REPOSITORY}" \
-o piper_master .
- uses: SAP/project-piper-action@master
with:
piper-version: latest
command: githubPublishRelease
flags: --token ${{ secrets.GITHUB_TOKEN }} --version latest --assetPath ./piper_master

27
.github/workflows/release-go.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Create new Release
on:
schedule:
- cron: '0 9 * * 1'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Prepare Release
run: |
curl --insecure --silent --location --write-out '%{http_code}' --output ./piper_master https://github.com/SAP/jenkins-library/releases/latest/download/piper_master
cp ./piper_master ./piper
npm install semver --quiet
echo "::set-env name=PIPER_version::v$(node_modules/.bin/semver -i minor $(curl --silent "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r .tag_name))"
- uses: SAP/project-piper-action@master
with:
piper-version: latest
command: githubPublishRelease
flags: --token ${{ secrets.GITHUB_TOKEN }} --assetPath ./piper_master
- uses: SAP/project-piper-action@master
with:
piper-version: latest
command: githubPublishRelease
flags: --token ${{ secrets.GITHUB_TOKEN }} --version latest --assetPath ./piper

View File

@ -21,29 +21,19 @@ cache:
# Travis GHPages deploy provider: https://docs.travis-ci.com/user/deployment/pages/
jobs:
include:
- stage: Tests
name: Golang Build & Publish
if: type != pull_request && repo = "SAP/jenkins-library" && branch = "master"
script:
- docker build -t piper:${TRAVIS_BRANCH} .
- docker create --name piper_${TRAVIS_BRANCH} piper:${TRAVIS_BRANCH}
- docker cp piper_${TRAVIS_BRANCH}:/build/piper .
- docker rm piper_${TRAVIS_BRANCH}
- cp ./piper ./piper_master
- chmod +x ./piper
- ./piper githubPublishRelease --token ${GITHUB_TOKEN} --version latest --assetPath ./piper_master
- name: Consumer Tests
- stage: Tests
name: Consumer Tests
if: repo = "SAP/jenkins-library" && ( (type != pull_request && branch =~ /^master$|^it\/.*$/) || (type == pull_request && head_repo = "SAP/jenkins-library" && head_branch =~ /^it\/.*$/) )
script: cd consumer-test && groovy consumerTestController.groovy
- stage: Docs
name: Create Documentation
install: docker pull squidfunk/mkdocs-material:3.0.4
before_script:
before_script:
- documentation/bin/createDocu.sh
- docker run -u `id -u`:`id -g` --rm -it -e GOCACHE=/tmp -v ${TRAVIS_BUILD_DIR}:/docu-gen golang sh -c "cd /docu-gen && go get github.com/SAP/jenkins-library/... && go run /docu-gen/pkg/generator/step-metadata.go --docuDir=/docu-gen/documentation/docs/steps/ --docuGen=true "
script:
- docker run -u `id -u`:`id -g` --rm -it -v ${TRAVIS_BUILD_DIR}/documentation:/docs squidfunk/mkdocs-material:3.0.4 build --clean --strict
after_script:
after_script:
- mkdir -p documentation/docs-gen/misc
- cp target/docuMetaData.json documentation/docs-gen/misc
deploy: