Compare commits
1 Commits
44102bc3f5
...
53b816473d
| Author | SHA1 | Date | |
|---|---|---|---|
| 53b816473d |
@@ -13,6 +13,8 @@ jobs:
|
|||||||
build-and-push:
|
build-and-push:
|
||||||
name: Build & Push Docker Image
|
name: Build & Push Docker Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.meta.outputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,6 +25,7 @@ jobs:
|
|||||||
VERSION=$(cat deb/PACKAGE | grep -oP '\d+\.\d+\.\d+' | head -1 || echo "unknown")
|
VERSION=$(cat deb/PACKAGE | grep -oP '\d+\.\d+\.\d+' | head -1 || echo "unknown")
|
||||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||||
echo "tag=${VERSION}-${SHORT_SHA}" >> $GITHUB_OUTPUT
|
echo "tag=${VERSION}-${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "Image will be tagged: ${VERSION}-${SHORT_SHA}"
|
echo "Image will be tagged: ${VERSION}-${SHORT_SHA}"
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -41,3 +44,33 @@ jobs:
|
|||||||
registry.johnogle.info/protonmail-bridge:${{ steps.meta.outputs.tag }}
|
registry.johnogle.info/protonmail-bridge:${{ steps.meta.outputs.tag }}
|
||||||
registry.johnogle.info/protonmail-bridge:latest
|
registry.johnogle.info/protonmail-bridge:latest
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy to Production
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-and-push
|
||||||
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
|
steps:
|
||||||
|
- name: Checkout k3s-cluster-config
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: johno/k3s-cluster-config
|
||||||
|
token: ${{ secrets.CONFIG_REPO_TOKEN }}
|
||||||
|
path: k3s-cluster-config
|
||||||
|
|
||||||
|
- name: Update HelmRelease image tag
|
||||||
|
run: |
|
||||||
|
cd k3s-cluster-config
|
||||||
|
sed -i 's|repository: shenxn/protonmail-bridge|repository: registry.johnogle.info/protonmail-bridge|' \
|
||||||
|
clusters/oglenet/apps/infrastructure/protonmail-bridge.yaml
|
||||||
|
sed -i 's/tag: .*/tag: "${{ needs.build-and-push.outputs.image_tag }}"/' \
|
||||||
|
clusters/oglenet/apps/infrastructure/protonmail-bridge.yaml
|
||||||
|
|
||||||
|
- name: Commit and push
|
||||||
|
run: |
|
||||||
|
cd k3s-cluster-config
|
||||||
|
git config user.name "Gitea CI"
|
||||||
|
git config user.email "ci@johnogle.info"
|
||||||
|
git add clusters/oglenet/apps/infrastructure/protonmail-bridge.yaml
|
||||||
|
git diff --cached --quiet || git commit -m "Deploy protonmail-bridge:${{ needs.build-and-push.outputs.image_tag }}"
|
||||||
|
git push
|
||||||
|
|||||||
Reference in New Issue
Block a user