-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: GitHub Actions Demo | ||
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 | ||
on: [push] | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
run: bash scripts/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Update Image Tag | ||
on: | ||
# schedule: | ||
# - cron: "29 10 1,5 * *" | ||
push: | ||
branches: ["master"] | ||
|
||
jobs: | ||
update-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout repo | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- run: bash scripts/update_tag.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
function get_latest_release { | ||
wget -q https://api.github.com/repos/$1/releases/latest -O - | # Get latest release from GitHub api | ||
grep '"tag_name":' | # Get tag line | ||
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | ||
} | ||
|
||
function get_tag { | ||
git tag | tail -n 1 | ||
} | ||
|
||
function build_n_push { | ||
docker buildx build . \ | ||
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \ | ||
--tag $1:$2 \ | ||
--tag $1:latest \ | ||
--push | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
dir=$(dirname $0) | ||
|
||
source $dir/functions.sh | ||
|
||
their_version=$(get_latest_release vercel/serve) | ||
our_version=$(get_tag) | ||
|
||
if [ "$their_version" \> "$our_version" ]; then | ||
git tag $their_version | ||
git push origin $their_version | ||
build_n_push eldekyfin/serve $their_version | ||
else | ||
echo Image is recent. Nothing to do... | ||
fi |