Build image in GitHub Actions

This commit is contained in:
Oleg Kalachev
2021-06-29 03:58:03 +03:00
parent 3383261d3e
commit d9bd9a531c
3 changed files with 42 additions and 15 deletions

22
.github/workflows/main.yml vendored Normal file
View File

@@ -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

View File

@@ -11,14 +11,14 @@ before_install:
- sudo apt install -y xvfb - sudo apt install -y xvfb
script: script:
- "xvfb-run ./build.sh" - "xvfb-run ./build.sh"
deploy: # deploy:
provider: s3 # provider: s3
access_key_id: XOJXX4IOM66XN7VZAFYX # access_key_id: XOJXX4IOM66XN7VZAFYX
secret_access_key: $S3_SECRET_KEY # secret_access_key: $S3_SECRET_KEY
bucket: clovervm # bucket: clovervm
local-dir: output-virtualbox-ovf # local-dir: output-virtualbox-ovf
acl: public_read # acl: public_read
on: # on:
all_branches: true # all_branches: true
skip_cleanup: true # skip_cleanup: true
endpoint: https://ams3.digitaloceanspaces.com # endpoint: https://ams3.digitaloceanspaces.com

View File

@@ -9,9 +9,14 @@ set -ex
PACKER="./packer" PACKER="./packer"
if [ ! -f ${PACKER} ]; then if [ ! -f ${PACKER} ]; then
echo "Packer not found; downloading v1.5.4 from Hashicorp" 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 if [[ "$OSTYPE" == "linux-gnu"* ]]; then
unzip packer_1.5.4_linux_amd64.zip OS=linux
rm packer_1.5.4_linux_amd64.zip 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 fi
echo "--- Using Packer version $(${PACKER} --version)" echo "--- Using Packer version $(${PACKER} --version)"
@@ -28,7 +33,7 @@ ${PACKER} build ros_ide_vm.json
echo "--- Marking the VM" echo "--- Marking the VM"
GIT_REV=$(git rev-parse --short HEAD) GIT_REV=$(git rev-parse --short HEAD)
GIT_DESCRIBE=$(git describe --tags) GIT_DESCRIBE=$(git describe --always)
VM_NAME="clover-devel_${GIT_DESCRIBE}.ova" VM_NAME="clover-devel_${GIT_DESCRIBE}.ova"
mv ./output-virtualbox-ovf/clover-devel.ova ./output-virtualbox-ovf/${VM_NAME} mv ./output-virtualbox-ovf/clover-devel.ova ./output-virtualbox-ovf/${VM_NAME}
ls -l output-virtualbox-ovf ls -l output-virtualbox-ovf