From 1c82d9f03556a5ca35077fc5c955d90b6c1a81da Mon Sep 17 00:00:00 2001 From: Nordine Bittich Date: Fri, 16 Dec 2022 23:26:31 +0100 Subject: [PATCH] github actions --- .github/workflows/build-latest.yml | 10 +++++---- .github/workflows/docker-publish.yml | 33 ++++++++++++++++++++++++++++ release.sh | 15 +++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 release.sh diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml index bc7f827..5710b6a 100644 --- a/.github/workflows/build-latest.yml +++ b/.github/workflows/build-latest.yml @@ -4,6 +4,8 @@ on: push: branches: - 'main' + - 'feat/**' + - 'chore/**' jobs: docker: @@ -11,19 +13,19 @@ jobs: steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2.1.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2.1.0 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2.1.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3.2.0 with: push: true tags: nbittich/websitev2:latest diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..bca590a --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,33 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3.1.0 + + - name: Log in to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4.1.0 + with: + images: nbittich/websitev2 + + - name: Build and push Docker image + uses: docker/build-push-action@v3.2.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..10170e1 --- /dev/null +++ b/release.sh @@ -0,0 +1,15 @@ + +git checkout main +git pull + +npm version $1 +npm i +git add . +git commit -m "version $1" + +echo "push tag $1..." +git push origin v$1 + +git push + +echo "done." \ No newline at end of file