From 5b94adff54b51c6fe18f2540cd05d22447cbb8a7 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 13 Aug 2023 14:10:30 +0200 Subject: [PATCH] publish lsp independently --- .github/workflows/publish_lsp.yml | 84 +++++++++++++++++++++++++++ .github/workflows/pypi_on_release.yml | 77 ------------------------ 2 files changed, 84 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/publish_lsp.yml diff --git a/.github/workflows/publish_lsp.yml b/.github/workflows/publish_lsp.yml new file mode 100644 index 0000000000..9d505f9f3f --- /dev/null +++ b/.github/workflows/publish_lsp.yml @@ -0,0 +1,84 @@ +env: + REGISTRY: ghcr.io + ECR_REGISTRY: 976079455550.dkr.ecr.us-east-1.amazonaws.com + IMAGE_NAME: ${{ github.repository }}-lsp + +name: Publish lsp +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: read + id-token: write + packages: write + +jobs: + publish_lsp: + runs-on: ubuntu-latest + steps: + - name: Sleep for 900 seconds waiting for pypi to update index + if: startsWith(github.ref, 'refs/tags/v') + run: sleep 900 + shell: bash + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: depot/setup-action@v1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push publicly + uses: depot/build-push-action@v1 + with: + context: "{{defaultContext}}:lsp" + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ steps.meta.outputs.tags }} + labels: | + ${{ steps.meta.outputs.labels }} + org.opencontainers.image.licenses=AGPLv3 + + publish_lsp_private: + needs: [publish_lsp] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to ECR + uses: docker/login-action@v2 + with: + registry: ${{ env.ECR_REGISTRY }} + username: ${{ secrets.AWS_ACCESS_KEY_ID }} + password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Push image to ECR + run: | + docker buildx imagetools create \ + --tag ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/pypi_on_release.yml b/.github/workflows/pypi_on_release.yml index 44758ff231..14278a284c 100644 --- a/.github/workflows/pypi_on_release.yml +++ b/.github/workflows/pypi_on_release.yml @@ -1,8 +1,3 @@ -env: - REGISTRY: ghcr.io - ECR_REGISTRY: 976079455550.dkr.ecr.us-east-1.amazonaws.com - IMAGE_NAME: ${{ github.repository }}-lsp - name: Publish python-client on: push: @@ -10,11 +5,6 @@ on: - "v*" workflow_dispatch: -permissions: - contents: read - id-token: write - packages: write - jobs: publish_pypi: runs-on: ubuntu-latest @@ -29,70 +19,3 @@ jobs: run: | cd python-client ./publish.sh - - publish_lsp: - runs-on: ubuntu-latest - steps: - - name: Sleep for 300 seconds waiting for pypi to update index - if: startsWith(github.ref, 'refs/tags/v') - run: sleep 300 - shell: bash - - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: depot/setup-action@v1 - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Login to registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push publicly - uses: depot/build-push-action@v1 - with: - context: "{{defaultContext}}:lsp" - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - ${{ steps.meta.outputs.tags }} - labels: | - ${{ steps.meta.outputs.labels }} - org.opencontainers.image.licenses=AGPLv3 - - publish_lsp_private: - needs: [publish_lsp] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to ECR - uses: docker/login-action@v2 - with: - registry: ${{ env.ECR_REGISTRY }} - username: ${{ secrets.AWS_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - - name: Push image to ECR - run: | - docker buildx imagetools create \ - --tag ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest