diff --git a/.github/workflows/common-self-hosting.yml b/.github/workflows/common-self-hosting.yml new file mode 100644 index 000000000..ee0127fc6 --- /dev/null +++ b/.github/workflows/common-self-hosting.yml @@ -0,0 +1,47 @@ +name: Reusable Publish Docker Self Hosting Image Workflow + +on: + workflow_call: + secrets: + DOCKER_USERNAME: + required: true + DOCKER_PASSWORD: + required: true + AWS_ACCESS_KEY_ID: + required: true + AWS_SECRET_ACCESS_KEY: + required: true + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Publish Docker image + uses: docker/build-push-action@v3 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + standardnotes/server:latest + standardnotes/server:${{ github.sha }} diff --git a/.github/workflows/common-server-application.yml b/.github/workflows/common-server-application.yml index 1a39ad6be..b2ac4e6af 100644 --- a/.github/workflows/common-server-application.yml +++ b/.github/workflows/common-server-application.yml @@ -211,10 +211,17 @@ jobs: workspace_name: ${{ inputs.workspace_name }} secrets: inherit + publish-self-hosting: + needs: [ build, test, lint, e2e ] + + name: Publish Self Hosting Docker Image + uses: standardnotes/server/.github/workflows/common-self-hosting.yml@main + secrets: inherit + deploy-web: if: ${{ inputs.deploy_web }} - needs: publish + needs: [ publish, publish-self-hosting ] name: Deploy Web uses: standardnotes/server/.github/workflows/common-deploy.yml@main @@ -226,7 +233,7 @@ jobs: deploy-worker: if: ${{ inputs.deploy_worker }} - needs: publish + needs: [ publish, publish-self-hosting ] name: Deploy Worker uses: standardnotes/server/.github/workflows/common-deploy.yml@main