From dbc236781bac18b9b34ff73f0357c54ace1b1e8d Mon Sep 17 00:00:00 2001 From: sinkaroid Date: Tue, 18 Apr 2023 13:01:35 +0700 Subject: [PATCH] ci: add docker build and push --- .github/workflows/docker.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..fb974e9 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,27 @@ +name: Docker + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Log into GitHub Container Registry + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Get the package.json version + id: package-version + run: echo ::set-output name=version::$(jq -r .version package.json) + - name: Build the Docker image + run: docker build . --file Dockerfile --tag ghcr.io/${{ github.repository }}:${{ steps.package-version.outputs.version }} + - name: Tag the Docker image + run: docker tag ghcr.io/${{ github.repository }}:${{ steps.package-version.outputs.version }} ghcr.io/${{ github.repository }}:latest + - name: Push the Docker image + run: docker push ghcr.io/${{ github.repository }} --all-tags + +