👷 Update Deploy Script

This commit is contained in:
Gautham Varma K
2023-02-19 13:59:39 +05:30
parent 4bbb4ec7fd
commit 78ece5ef00
+20 -19
View File
@@ -53,8 +53,8 @@ jobs:
fi fi
fi fi
echo "::set-output name=environment::${environment}" echo "environment=${environment}" >> "$GITHUB_OUTPUT"
echo "::set-output name=version::${version}" echo "version=${version}" >> "$GITHUB_OUTPUT"
deploy: deploy:
name: 👷 Build & Deploy ${{ matrix.architecture }} name: 👷 Build & Deploy ${{ matrix.architecture }}
@@ -79,31 +79,32 @@ jobs:
restore-keys: | restore-keys: |
docker-${{ matrix.architecture }} docker-${{ matrix.architecture }}
- name: 🏗 Set up QEMU - name: 🏗 Set up QEMU
uses: docker/setup-qemu-action@v1.2.0 uses: docker/setup-qemu-action@v2.1.0
- name: 🏗 Set up Docker Buildx - name: 🏗 Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0 uses: docker/setup-buildx-action@v2.4.1
- name: ️ Compose build flags - name: ️ Compose build flags
id: flags id: flags
run: | run: |
echo "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")" echo "date=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT"
from=$(yq --no-colors eval ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}") from=$(yq --no-colors eval ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}")
echo "::set-output name=from::${from}" echo "from=${from}" >> "$GITHUB_OUTPUT"
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then if [[ "${{ matrix.architecture}}" = "amd64" ]]; then
echo "::set-output name=platform::linux/amd64" echo "platform=linux/amd64" >> "$GITHUB_OUTPUT"
elif [[ "${{ matrix.architecture }}" = "i386" ]]; then elif [[ "${{ matrix.architecture }}" = "i386" ]]; then
echo "::set-output name=platform::linux/386" echo "platform=linux/386" >> "$GITHUB_OUTPUT"
elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then
echo "::set-output name=platform::linux/arm/v6" echo "platform=linux/arm/v6" >> "$GITHUB_OUTPUT"
elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then
echo "::set-output name=platform::linux/arm/v7" echo "platform=linux/arm/v7" >> "$GITHUB_OUTPUT"
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then
echo "::set-output name=platform::linux/arm64/v8" echo "platform=linux/arm64/v8" >> "$GITHUB_OUTPUT"
else else
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}" echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}"
exit 1 exit 1
fi fi
- name: 🏗 Login to GitHub Container Registry - name: 🏗 Login to GitHub Container Registry
uses: docker/login-action@v1.14.1 uses: docker/login-action@v2.1.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@@ -116,14 +117,14 @@ jobs:
load: true load: true
# yamllint disable rule:line-length # yamllint disable rule:line-length
tags: | tags: |
ghcr.io/gauthamvarmak/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }} ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }}
ghcr.io/gauthamvarmak/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }} ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}
# yamllint enable rule:line-length # yamllint enable rule:line-length
context: ${{ needs.information.outputs.target }} context: ${{ needs.information.outputs.target }}
file: ${{ needs.information.outputs.target }}/Dockerfile file: ${{ needs.information.outputs.target }}/Dockerfile
cache-from: | cache-from: |
type=local,src=/tmp/.docker-cache type=local,src=/tmp/.docker-cache
ghcr.io/gauthamvarmak/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new
platforms: ${{ steps.flags.outputs.platform }} platforms: ${{ steps.flags.outputs.platform }}
build-args: | build-args: |
@@ -147,9 +148,9 @@ jobs:
# yamllint disable rule:line-length # yamllint disable rule:line-length
run: | run: |
docker push \ docker push \
"ghcr.io/gauthamvarmak/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }}" "ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }}"
docker push \ docker push \
"ghcr.io/gauthamvarmak/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}" "ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}"
publish-stable: publish-stable:
name: 📢 Publish to stable repository name: 📢 Publish to stable repository
@@ -162,10 +163,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🚀 Dispatch repository updater update signal - name: 🚀 Dispatch repository updater update signal
uses: peter-evans/repository-dispatch@v2 uses: peter-evans/repository-dispatch@v2.1.1
with: with:
token: ${{ secrets.DISPATCH_TOKEN }} token: ${{ secrets.DISPATCH_TOKEN }}
repository: GauthamVarmaK/hassio-addons repository: ghcr.io/${{ github.repository_owner }}/hassio-addons
event-type: update event-type: update
client-payload: > client-payload: >
{ {