From d9bd9a531c5d68cea9e8a6c0f18f327560b36c4a Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 29 Jun 2021 03:58:03 +0300 Subject: [PATCH] Build image in GitHub Actions --- .github/workflows/main.yml | 22 ++++++++++++++++++++++ .travis.yml | 22 +++++++++++----------- build.sh | 13 +++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ccd36d9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,22 @@ +name: Build image + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: macos-10.15 # Using macOS as https://github.com/actions/virtual-environments/issues/183 + steps: + - uses: actions/checkout@v2 + - name: Download base image + run: | + mkdir output-virtualbox-iso + wget --progress=dot:giga https://clovervm.ams3.digitaloceanspaces.com/base-focal.ova -O output-virtualbox-iso/clover-devel.ova + - name: Build + run: ./build.sh + - name: Upload + run: AWS_ACCESS_KEY_ID=${{secrets.S3_KEY}} AWS_SECRET_ACCESS_KEY=${{secrets.S3_SECRET_KEY}} aws s3 sync . s3://clovervm/ --acl public-read --endpoint-url https://ams3.digitaloceanspaces.com --no-progress + working-directory: output-virtualbox-ovf diff --git a/.travis.yml b/.travis.yml index 0177289..8c756f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,14 @@ before_install: - sudo apt install -y xvfb script: - "xvfb-run ./build.sh" -deploy: - provider: s3 - access_key_id: XOJXX4IOM66XN7VZAFYX - secret_access_key: $S3_SECRET_KEY - bucket: clovervm - local-dir: output-virtualbox-ovf - acl: public_read - on: - all_branches: true - skip_cleanup: true - endpoint: https://ams3.digitaloceanspaces.com +# deploy: +# provider: s3 +# access_key_id: XOJXX4IOM66XN7VZAFYX +# secret_access_key: $S3_SECRET_KEY +# bucket: clovervm +# local-dir: output-virtualbox-ovf +# acl: public_read +# on: +# all_branches: true +# skip_cleanup: true +# endpoint: https://ams3.digitaloceanspaces.com diff --git a/build.sh b/build.sh index 69473bb..bfab021 100755 --- a/build.sh +++ b/build.sh @@ -9,9 +9,14 @@ set -ex PACKER="./packer" if [ ! -f ${PACKER} ]; then echo "Packer not found; downloading v1.5.4 from Hashicorp" - wget --progress=dot:giga https://releases.hashicorp.com/packer/1.5.4/packer_1.5.4_linux_amd64.zip - unzip packer_1.5.4_linux_amd64.zip - rm packer_1.5.4_linux_amd64.zip + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + OS=linux + elif [[ "$OSTYPE" == "darwin"* ]]; then + OS=darwin + fi + wget --progress=dot:giga https://releases.hashicorp.com/packer/1.5.4/packer_1.5.4_${OS}_amd64.zip + unzip packer_1.5.4_${OS}_amd64.zip + rm packer_1.5.4_${OS}_amd64.zip fi echo "--- Using Packer version $(${PACKER} --version)" @@ -28,7 +33,7 @@ ${PACKER} build ros_ide_vm.json echo "--- Marking the VM" GIT_REV=$(git rev-parse --short HEAD) -GIT_DESCRIBE=$(git describe --tags) +GIT_DESCRIBE=$(git describe --always) VM_NAME="clover-devel_${GIT_DESCRIBE}.ova" mv ./output-virtualbox-ovf/clover-devel.ova ./output-virtualbox-ovf/${VM_NAME} ls -l output-virtualbox-ovf