From c210076a4f1e86c4a5ddd32f0913257553a182e2 Mon Sep 17 00:00:00 2001 From: Anton Shepilov Date: Fri, 2 Feb 2024 13:50:01 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20Publish=20registration=20page=20?= =?UTF-8?q?to=20docker=20(#24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr.yml | 15 ++++++++++ .github/workflows/push.yml | 16 +++++++++++ .../workflows/registration-build.yml | 15 ++-------- .github/workflows/registration-publish.yml | 28 +++++++++++++++++++ registration/.github/workflows/docker.yml | 18 ------------ 5 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/push.yml rename registration/.github/workflows/main.yml => .github/workflows/registration-build.yml (70%) create mode 100644 .github/workflows/registration-publish.yml delete mode 100644 registration/.github/workflows/docker.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..335ba79 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,15 @@ +name: pr + +on: + pull_request: + branches: + - main + - master + merge_group: + workflow_dispatch: + +jobs: + test: + name: Build And Test + uses: ./.github/workflows/registration-publish.yml + secrets: inherit diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..7dd6e79 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,16 @@ +on: + push: + branches: + - main + +jobs: + test: + name: Build And Test + uses: ./.github/workflows/registration-build.yml + secrets: inherit + + publish: + needs: [test] + name: Publish Registration Page + uses: ./.github/workflows/registration-publish.yml + secrets: inherit \ No newline at end of file diff --git a/registration/.github/workflows/main.yml b/.github/workflows/registration-build.yml similarity index 70% rename from registration/.github/workflows/main.yml rename to .github/workflows/registration-build.yml index 282b7a9..2bc4ef9 100644 --- a/registration/.github/workflows/main.yml +++ b/.github/workflows/registration-build.yml @@ -1,16 +1,8 @@ -name: CI +name: build on: - push: - branches: - - main - pull_request: - branches: - - main + workflow_call: - workflow_dispatch: -env: - CI: true jobs: build: runs-on: ubuntu-latest @@ -27,7 +19,6 @@ jobs: node-version: ${{ matrix.node-version }} - name: npm install and build run: | + cd registration npm i npm run build --if-present - env: - CI: true diff --git a/.github/workflows/registration-publish.yml b/.github/workflows/registration-publish.yml new file mode 100644 index 0000000..9498a9e --- /dev/null +++ b/.github/workflows/registration-publish.yml @@ -0,0 +1,28 @@ +name: Docker Build + +on: + workflow_call: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Get all src files that have changed + id: changed-files + uses: tj-actions/changed-files@v41 + with: + files: | + packages/registration/**/* + .github/workflows/** + - name: Publish to dockerhub + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: linagora/twake-matrix-registration + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + workdir: "${{ github.workspace }}/registration" + context: . + buildoptions: "-t linagora/twake-matrix-registration -f Dockerfile" + tags: "latest" + diff --git a/registration/.github/workflows/docker.yml b/registration/.github/workflows/docker.yml deleted file mode 100644 index b589060..0000000 --- a/registration/.github/workflows/docker.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker build -on: - push: - branches: - - main -env: - CI: true -jobs: - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Kaniko build - uses: aevea/action-kaniko@master - with: - image: kferjani/twake-matrix-register - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }}