Skip to content

Commit

Permalink
configure github-action to generate bosh releases
Browse files Browse the repository at this point in the history
  • Loading branch information
psycofdj committed Feb 13, 2021
1 parent db91483 commit 9b45e27
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 25 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build-and-release

on:
push:
# not not consider simplec commit
branches:
- '!*'
# consider only release and pre-release tags
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: create bosh release
id: create-bosh-release
uses: orange-cloudfoundry/bosh-release-action@v1
if: success() && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_BOSH_ACCES_KEY_ID: ${{ secrets.AWS_BOSH_ACCES_KEY_ID }}
AWS_BOSH_SECRET_ACCES_KEY: ${{ secrets.AWS_BOSH_SECRET_ACCES_KEY }}

- name: create github release
id: create-github-release
if: success() && startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: "cutting release ${{ steps.create-bosh-release.outputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: upload-assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-github-release.outputs.upload_url }}
asset_path: ./${{ steps.create-bosh-release.outputs.file }}
asset_name: ${{ steps.create-bosh-release.outputs.file }}
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ tmp
*~
*#
#*
*.tar.gz
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

5 changes: 4 additions & 1 deletion config/blobs.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
boshupdate_exporter_linux.tar.gz:
size: 9088833
object_id: 2ba79aaa-66d1-4614-6474-aca1721c27ad
sha: sha256:61097a36e603a0dafcf64a34db8cb3404b8a8a1a6c952bb532940a27967b2c64
21 changes: 6 additions & 15 deletions packages/boshupdate_exporter/packaging
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
#!/bin/bash -eu
#!/bin/bash -e

ostype=$(uname | tr '[:upper:]' '[:lower:]')
if [ -z "${BOSH_PACKAGES_DIR-}" ]; then
pkg_dir=$(readlink -nf /var/vcap/packages/golang-1-${ostype})
else
pkg_dir=${BOSH_PACKAGES_DIR}/golang-1-${ostype}
fi
bin_name="boshupdate_exporter"
tar_name="${bin_name}_${ostype}.tar.gz"

PACKAGE_NAME="github.com/orange-cloudfoundry/boshupdate_exporter"

source ${pkg_dir}/bosh/compile.env

mkdir -p ${GOPATH}/src/${PACKAGE_NAME}
mkdir -p ${BOSH_INSTALL_TARGET}/bin
cp -r boshupdate_exporter/* ${GOPATH}/src/${PACKAGE_NAME}

cd ${GOPATH}/src/${PACKAGE_NAME}/exporter
go build -a -ldflags "-s -w" -gcflags="all=-trimpath=$GOPATH" -o ${BOSH_INSTALL_TARGET}/bin/boshupdate_exporter
tar zxf ${tar_name} --strip 1 -C ${BOSH_INSTALL_TARGET}
mv ${BOSH_INSTALL_TARGET}/${bin_name} ${BOSH_INSTALL_TARGET}/bin
mv ${BOSH_INSTALL_TARGET}/boshupdate_cli ${BOSH_INSTALL_TARGET}/bin
5 changes: 2 additions & 3 deletions packages/boshupdate_exporter/spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: boshupdate_exporter

dependencies:
- golang-1-linux
dependencies: []

files:
- boshupdate_exporter/**
- boshupdate_exporter_linux.tar.gz

...
2 changes: 0 additions & 2 deletions packages/golang-1-linux/spec.lock

This file was deleted.

Empty file added src/.keep
Empty file.
1 change: 0 additions & 1 deletion src/boshupdate_exporter
Submodule boshupdate_exporter deleted from 3ff5ec

0 comments on commit 9b45e27

Please sign in to comment.