From a9b6cf56bc594462b2a065c1177355815001b9bb Mon Sep 17 00:00:00 2001 From: Hugo Labrador Date: Thu, 16 Nov 2023 14:47:42 +0100 Subject: [PATCH] Move CI to GH actions (#219) --- .drone.yml | 64 ------------------------- .github/workflows/build-and-publish.yml | 29 +++++++++++ .github/workflows/build-only.yml | 15 ++++++ Makefile | 4 +- 4 files changed, 46 insertions(+), 66 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/build-and-publish.yml create mode 100644 .github/workflows/build-only.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 29f62fc..0000000 --- a/.drone.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -kind: pipeline -type: docker -name: build-and-publish - -platform: - os: linux - arch: amd64 - -trigger: - branch: - - main - event: - exclude: - - pull_request - - tag - - promote - - rollback - -steps: -- name: build-and-publish - pull: always - image: cs3org/cs3apis:latest - environment: - SSH_KEY: - from_secret: deploy_gh_key - commands: - # See https://github.com/drone/drone/issues/2692 - # write the ssh key to disk - - mkdir /root/.ssh - - echo -n "$SSH_KEY" > /root/.ssh/id_rsa - - shasum /root/.ssh/id_rsa - - chmod 600 /root/.ssh/id_rsa - - stat /root/.ssh/id_rsa - - # add github to known hosts - - touch /root/.ssh/known_hosts - - chmod 600 /root/.ssh/known_hosts - - ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts 2> /dev/null - - cs3apis-build -push-go -push-python -push-js -push-node -git-ssh # compile, build and publish all available languages - ---- -kind: pipeline -type: docker -name: build-only - -platform: - os: linux - arch: amd64 - -trigger: - event: - include: - - pull_request - - tag - - promote - - rollback - -steps: -- name: build-only - pull: always - image: cs3org/cs3apis:latest - commands: - - cs3apis-build # compile, build and publish all available languages diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..d2dc774 --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,29 @@ +--- +name: Build and Publish +on: + push: + branches: + - main +jobs: + build-and-publish: + name: Build and publish + runs-on: ubuntu-latest + container: cs3org/cs3apis-build:master + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: setup-ssh + env: + SSH_KEY: ${{ secrets.ssh_key}} + run: | + mkdir /root/.ssh + python3 -c "import os; file = open('/root/.ssh/id_rsa', 'w'); file.write(os.environ['SSH_KEY']); file.close()" + shasum /root/.ssh/id_rsa + chmod 400 /root/.ssh/id_rsa + stat /root/.ssh/id_rsa + touch /root/.ssh/known_hosts + chmod 400 /root/.ssh/known_hosts + ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts 2> /dev/null + cat /root/.ssh/id_rsa + - name: build-and-publish + run: cs3apis-build -git-ssh -push-go -push-js -push-node -push-python diff --git a/.github/workflows/build-only.yml b/.github/workflows/build-only.yml new file mode 100644 index 0000000..577ce4b --- /dev/null +++ b/.github/workflows/build-only.yml @@ -0,0 +1,15 @@ +--- +name: Build only +on: + pull_request: + branches: [ "main" ] +jobs: + build: + name: Build only + runs-on: ubuntu-latest + container: cs3org/cs3apis-build:master + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: build-and-publish + run: cs3apis-build diff --git a/Makefile b/Makefile index 8714294..6adc087 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ pwd = $(shell pwd) default: gen gen: - docker run -v ${pwd}:/root/cs3apis hugo cs3apis-build - #docker run -v ${pwd}:/root/cs3apis cs3org/cs3apis cs3apis-build + echo ${pwd} + docker run -v ${pwd}:/root/cs3apis cs3org/cs3apis-build:master cs3apis-build clean: rm -rf build/