diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0711f08 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index 4afe16d..3f99224 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ tmp *~ *# #* +*.tar.gz diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index fa4ed80..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/boshupdate_exporter"] - path = src/boshupdate_exporter - url = ../boshupdate_exporter.git diff --git a/config/blobs.yml b/config/blobs.yml index 0967ef4..a065e48 100644 --- a/config/blobs.yml +++ b/config/blobs.yml @@ -1 +1,4 @@ -{} +boshupdate_exporter_linux.tar.gz: + size: 9088833 + object_id: 2ba79aaa-66d1-4614-6474-aca1721c27ad + sha: sha256:61097a36e603a0dafcf64a34db8cb3404b8a8a1a6c952bb532940a27967b2c64 diff --git a/packages/boshupdate_exporter/packaging b/packages/boshupdate_exporter/packaging index 40440b3..3bd75c2 100644 --- a/packages/boshupdate_exporter/packaging +++ b/packages/boshupdate_exporter/packaging @@ -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 diff --git a/packages/boshupdate_exporter/spec b/packages/boshupdate_exporter/spec index 39b3b7c..821b8a2 100644 --- a/packages/boshupdate_exporter/spec +++ b/packages/boshupdate_exporter/spec @@ -1,10 +1,9 @@ --- name: boshupdate_exporter -dependencies: - - golang-1-linux +dependencies: [] files: - - boshupdate_exporter/** + - boshupdate_exporter_linux.tar.gz ... diff --git a/packages/golang-1-linux/spec.lock b/packages/golang-1-linux/spec.lock deleted file mode 100644 index 9831033..0000000 --- a/packages/golang-1-linux/spec.lock +++ /dev/null @@ -1,2 +0,0 @@ -name: golang-1-linux -fingerprint: ef771f8c7b5d835ebfa08a1f7a485b0db7928d013ec69d911ca88bb12e6c1261 diff --git a/src/.keep b/src/.keep new file mode 100644 index 0000000..e69de29 diff --git a/src/boshupdate_exporter b/src/boshupdate_exporter deleted file mode 160000 index 3ff5ecd..0000000 --- a/src/boshupdate_exporter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3ff5ecdf8ef617990a3be04242b8bf3203e87cd5