From 178e109c3fd95f0decab37f16f10b181c6804cd0 Mon Sep 17 00:00:00 2001 From: Caspar Oostendorp Date: Mon, 18 Dec 2023 09:29:32 +0800 Subject: [PATCH] wip --- .github/workflows/docker-image.yml | 73 ++++++++++++++++-------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 6869579..4af6081 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,40 +12,43 @@ env: jobs: buildImage: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout repository uses: actions/checkout@v2 -# - name: Cache node modules -# uses: actions/cache@v2 -# env: -# cache-name: cache-node-modules-web -# with: -# # npm cache files are stored in `~/.npm` on Linux/macOS -# path: web/node_modules -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# ${{ runner.os }}-build- -# ${{ runner.os }}- -# -# - name: Cache node modules -# uses: actions/cache@v2 -# env: -# cache-name: cache-node-modules-bots -# with: -# # npm cache files are stored in `~/.npm` on Linux/macOS -# path: bots/node_modules -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# ${{ runner.os }}-build- -# ${{ runner.os }}- -# -# + # - name: Cache node modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-node-modules-web + # with: + # # npm cache files are stored in `~/.npm` on Linux/macOS + # path: web/node_modules + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # ${{ runner.os }}-build- + # ${{ runner.os }}- + # + # - name: Cache node modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-node-modules-bots + # with: + # # npm cache files are stored in `~/.npm` on Linux/macOS + # path: bots/node_modules + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # ${{ runner.os }}-build- + # ${{ runner.os }}- + # + # - name: Log in to the Container registry - uses: docker/login-action + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: registry: ghcr.io username: ${{ github.actor }} @@ -53,16 +56,16 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # - name: Build, tag, and push image - # id: build-image - # run: | - # docker build -t $REGISTRY/$PROJECTNAME:${VERSION} -t $REGISTRY/$PROJECTNAME:latest . - # docker push $REGISTRY/$PROJECTNAME:latest - # docker push $REGISTRY/$PROJECTNAME:${VERSION} + - name: Build, tag, and push image + id: build-image + run: | + docker build -t $REGISTRY/$PROJECTNAME:${VERSION} -t $REGISTRY/$PROJECTNAME:latest . + docker push $REGISTRY/$PROJECTNAME:latest + docker push $REGISTRY/$PROJECTNAME:${VERSION}