Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Move web backend action and rename to main

Russ Garretta5a206fde7ca
diff --git a/.github/workflows/web-backend.yml b/.github/workflows/web-backend.yml
new file mode 100644
index 0000000..fe805da
--- /dev/null
+++ b/.github/workflows/web-backend.yml
@@ -0,0 +1,39 @@
+name: Build web backend container
+
+on:
+ push:
+ branches: main
+ paths:
+ - 'web-backend/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v3
+ with:
+ images: |
+ ghcr.io/openinframap/web-backend
+ flavor: |
+ latest=true
+ tags: |
+ type=sha
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and push
+ id: docker_build
+ uses: docker/build-push-action@v2
+ with:
+ context: ./web-backend
+ file: ./web-backend/Dockerfile.prod
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml
index a0a4e5f..0270d46 100644
--- a/.github/workflows/web.yml
+++ b/.github/workflows/web.yml
@@ -2,7 +2,7 @@ name: Build web container
on:
push:
- branches: master
+ branches: main
paths:
- 'web/**'
diff --git a/web-backend/.github/workflows/build-and-deploy.yml b/web-backend/.github/workflows/build-and-deploy.yml
deleted file mode 100644
index 7d12955..0000000
--- a/web-backend/.github/workflows/build-and-deploy.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: Build and Publish
-
-on:
- push:
-
-env:
- IMAGE_NAME: web-backend
-
-jobs:
- build:
- runs-on: ubuntu-latest
- if: github.event_name == 'push'
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Build
- run: docker build . --tag $IMAGE_NAME
-
- - name: Push image to GitHub Container Registry
- if: github.ref == 'refs/heads/main'
- run: |
- echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
-
- IMAGE_ID=ghcr.io/${{ github.repository }}
- IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
-
- echo IMAGE_ID=$IMAGE_ID
- echo VERSION=${{ github.sha }}
-
- docker tag $IMAGE_NAME $IMAGE_ID:${{ github.sha }}
- docker push $IMAGE_ID:${{ github.sha }}
- docker tag $IMAGE_NAME $IMAGE_ID:latest
- docker push $IMAGE_ID:latest