Skip to content

Commit

Permalink
🐳Publish docker image for federation server
Browse files Browse the repository at this point in the history
  • Loading branch information
shepilov committed Jan 31, 2024
1 parent f8bfe9c commit b16fb45
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 64 deletions.
65 changes: 1 addition & 64 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,67 +39,4 @@ jobs:
- name: Install playwright test browsers
run: npx playwright install
- name: Run all tests
run: npm test

publish-docker:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'
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/matrix-invite/**/*
- name: Build and publish matrix-invite docker image
if: steps.changed-files.outputs.any_changed == 'true'
uses: philips-software/docker-ci-scripts@v5.1.0
with:
base-dir: "${{ github.workspace }}/packages/matrix-invite/"
dockerfile: "${{ github.workspace }}/packages/matrix-invite/Dockerfile"
image-name: "twake-matrix-invite"
tags: "latest"
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }}
REGISTRY_TOKEN: "${{ secrets.DOCKERHUB_PASSWORD }}"
DOCKER_ORGANIZATION: twaketech

update-doc:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Node LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Generate Swagger documentation
run: npm run doc
- name: Check if documentation files has changed
id: verify-changed-files
uses: tj-actions/verify-changed-files@v17
with:
files: docs/openapi.json
- name: Update documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
SPEC_TO_DISPLAY: "openapi.json"
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}"
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin"
run: |
yes | cp -rf node_modules/swagger-ui-dist/* docs
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" docs/swagger-initializer.js
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" docs/swagger-initializer.js
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" docs/swagger-initializer.js
- name: Commit updated documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
add: docs
message: 'chore: update documentation'
run: npm test
76 changes: 76 additions & 0 deletions .github/workflows/publish-matrix-invite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
workflow_run:
workflows: [Node.js CI]
types:
- completed

jobs:
tests:
uses: ./.github/workflows/tests.yml
publish-docker:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'
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/matrix-invite/**/*
- name: Build and publish matrix-invite docker image
if: steps.changed-files.outputs.any_changed == 'true'
uses: philips-software/docker-ci-scripts@v5.1.0
with:
base-dir: "${{ github.workspace }}/packages/matrix-invite/"
dockerfile: "${{ github.workspace }}/packages/matrix-invite/Dockerfile"
image-name: "twake-matrix-invite"
tags: "latest"
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }}
REGISTRY_TOKEN: "${{ secrets.DOCKERHUB_PASSWORD }}"
DOCKER_ORGANIZATION: twaketech

update-doc:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Node LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Generate Swagger documentation
run: npm run doc
- name: Check if documentation files has changed
id: verify-changed-files
uses: tj-actions/verify-changed-files@v17
with:
files: docs/openapi.json
- name: Update documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
SPEC_TO_DISPLAY: "openapi.json"
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}"
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin"
run: |
yes | cp -rf node_modules/swagger-ui-dist/* docs
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" docs/swagger-initializer.js
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" docs/swagger-initializer.js
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" docs/swagger-initializer.js
- name: Commit updated documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
add: docs
message: 'chore: update documentation'
Empty file.

0 comments on commit b16fb45

Please sign in to comment.