-
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
3 changed files
with
143 additions
and
0 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 @@ | ||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
assignees: | ||
- "xZero707" | ||
|
||
# Maintain Docker image dependencies | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
assignees: | ||
- "xZero707" |
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,43 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 16 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.PAT_TOKEN}} | ||
- | ||
name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
files: build/docker-bake.hcl | ||
push: true |
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,82 @@ | ||
group "default" { | ||
targets = [ | ||
"latest" | ||
] | ||
} | ||
|
||
target "build-dockerfile" { | ||
dockerfile = "Dockerfile" | ||
} | ||
|
||
target "build-platforms" { | ||
platforms = ["linux/amd64"] | ||
} | ||
|
||
target "build-common" { | ||
pull = true | ||
} | ||
|
||
###################### | ||
# Define the variables | ||
###################### | ||
|
||
variable "REGISTRY_CACHE" { | ||
default = "docker.io/nlss/megacmd-cache" | ||
} | ||
|
||
###################### | ||
# Define the functions | ||
###################### | ||
|
||
# Get the arguments for the build | ||
function "get-args" { | ||
params = [version] | ||
result = { | ||
MEGA_DOWNLOAD_URL = version | ||
} | ||
} | ||
|
||
# Get the cache-from configuration | ||
function "get-cache-from" { | ||
params = [version] | ||
result = [ | ||
"type=registry,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}" | ||
] | ||
} | ||
|
||
# Get the cache-to configuration | ||
function "get-cache-to" { | ||
params = [version] | ||
result = [ | ||
"type=registry,mode=max,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}" | ||
] | ||
} | ||
|
||
# Get list of image tags and registries | ||
# Takes a version and a list of extra versions to tag | ||
# eg. get-tags("1.0.0", ["1.0", "latest"]) | ||
function "get-tags" { | ||
params = [version, extra_versions] | ||
result = concat( | ||
[ | ||
"ghcr.io/n0rthernl1ghts/megacmd:${version}" | ||
], | ||
flatten([ | ||
for extra_version in extra_versions : [ | ||
"ghcr.io/n0rthernl1ghts/megacmd:${extra_version}" | ||
] | ||
]) | ||
) | ||
} | ||
|
||
########################## | ||
# Define the build targets | ||
########################## | ||
|
||
target "latest" { | ||
inherits = ["build-dockerfile", "build-platforms", "build-common"] | ||
cache-from = get-cache-from("latest") | ||
cache-to = get-cache-to("latest") | ||
tags = get-tags("latest", []) | ||
args = get-args("https://mega.nz/linux/repo/Fedora_38/x86_64/megacmd-Fedora_38.x86_64.rpm") | ||
} |