diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index 49ff2cc7..7ad140a9 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -24,29 +24,26 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Test - run: | - ls - # - name: Build and push Apollo CLI - # uses: docker/build-push-action@v5 - # with: - # platforms: linux/arm64/v8,linux/amd64 - # push: true - # tags: ghcr.io/gmod/apollo-cli:${{ inputs.tag }} - # context: packages/apollo-cli - # outputs: - # type=image,annotation-index.org.opencontainers.image.description= - # Apollo CLI - # cache-from: type=registry,ref=user/app:latest - # cache-to: type=inline - # - name: Build and push Apollo collaboration server image - # uses: docker/build-push-action@v5 - # with: - # platforms: linux/arm64/v8,linux/amd64 - # push: true - # tags: ghcr.io/gmod/apollo-collaboration-server:${{ inputs.tag }} - # outputs: - # type=image,annotation-index.org.opencontainers.image.description=Apollo - # collaboration server - # cache-from: type=registry,ref=user/app:latest - # cache-to: type=inline + - name: Build and push Apollo CLI + uses: docker/build-push-action@v5 + with: + platforms: linux/arm64/v8,linux/amd64 + push: false # true + tags: ghcr.io/gmod/apollo-cli:${{ inputs.tag }} + context: packages/apollo-cli + outputs: + type=image,annotation-index.org.opencontainers.image.description= + Apollo CLI + cache-from: type=registry,ref=user/app:latest + cache-to: type=inline + - name: Build and push Apollo collaboration server image + uses: docker/build-push-action@v5 + with: + platforms: linux/arm64/v8,linux/amd64 + push: false # true + tags: ghcr.io/gmod/apollo-collaboration-server:${{ inputs.tag }} + outputs: + type=image,annotation-index.org.opencontainers.image.description=Apollo + collaboration server + cache-from: type=registry,ref=user/app:latest + cache-to: type=inline diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..7d7b2468 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish Apollo + +on: + push: + # tags: 'v[0-9]' + +env: + tag: devel + +jobs: + publish-npm: + name: Publish to npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v4 + with: + node-version: '18.x' + cache: yarn + registry-url: 'https://registry.npmjs.org' + scope: '@apollo-annotation' + - run: yarn --immutable + - run: | + yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }} + yarn workspaces foreach --no-private --all npm publish --tolerate-republish --tag $tag + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + publish-docker: + name: Build and push Docker image + uses: ./.github/workflows/build-and-push-docker.yml + with: + tag: $tag diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 70615a5d..add7be2e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -69,9 +69,9 @@ jobs: uses: ./.github/workflows/build-and-push-docker.yml with: tag: 'development' - #if: - # ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || - # inputs.publish }} + if: + ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || + inputs.publish }} deploy: name: Deploy to demo staging server runs-on: ubuntu-latest