15 Commits

Author SHA1 Message Date
ViViDboarder 5f3f05247a Fail build when upload fails
Also updates test to catch this issue
2022-08-10 15:25:05 -07:00
ViViDboarder 06beaed6ab Switch to latest version of Alpine and fix intersection 2022-08-10 15:01:37 -07:00
ViViDboarder 73ee27f14e Build intersection of supported GitHub and Alpine platforms 2022-08-10 14:58:06 -07:00
ViViDboarder 66ac1fa9a7 Revert "Build all available platforms"
This reverts commit 9fc797e244.
2022-08-10 14:54:37 -07:00
ViViDboarder 051ccd20e3 Update Alpine version
Should support more archs
2022-08-10 14:52:41 -07:00
ViViDboarder 9fc797e244 Build all available platforms 2022-08-10 14:48:59 -07:00
ViViDboarder 30acb3ee44 Update docker/metadata-action 2022-08-10 14:46:23 -07:00
ViViDboarder 95baa0b710 Better tags for latest 2022-08-10 14:41:30 -07:00
ViViDboarder d88042153f Fix printing of available platforms 2022-08-10 14:40:14 -07:00
Ian 6dd4d6a367 Update docker-publish.yml
Hard code username to hopefully fix login
2022-08-10 14:31:52 -07:00
Ian 6d0e68aeea Create docker-publish.yml
Docker builds using GitHub Actions
2022-08-10 14:28:04 -07:00
ViViDboarder eaf8993535 Add multi file test 2022-04-24 09:58:00 -07:00
ViViDboarder 55ea8f5fe7 Woops. Forgot to indent a few variables
Part of fix for #13
2020-08-26 16:35:39 -07:00
ViViDboarder 7b236ca078 Update readme to reflect plugin settings syntax
Fixes #13
2020-08-26 16:34:16 -07:00
ViViDboarder 30febb63a3 Add all make target for test and lint 2020-05-19 13:52:36 -07:00
9 changed files with 131 additions and 19 deletions
+104
View File
@@ -0,0 +1,104 @@
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "master" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
REGISTRY_USERNAME: vividboarder
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
with:
cosign-release: 'v1.9.0'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
id: buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Tag default branch as latest
type=raw,value=latest,enable={{is_default_branch}}
# Semver tags for tagged versions
type=semver,pattern={{version}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
+2 -2
View File
@@ -1,6 +1,6 @@
FROM alpine:3.11
FROM alpine:3.16
RUN apk --no-cache add bash=~5.0 curl=~7.67 ca-certificates=~20191127
RUN apk --no-cache add bash=~5.1 curl=~7.83 ca-certificates=~20220614
COPY push.sh /bin/
RUN chmod +x /bin/push.sh
+5 -2
View File
@@ -1,10 +1,10 @@
.PHONY: clean all
.PHONY: clean
.PHONY: default
default: test
.PHONY: test
test: check
test:
docker-compose -f ./tests/docker-compose-private.yml up \
--build --force-recreate \
--abort-on-container-exit --exit-code-from plugin
@@ -18,3 +18,6 @@ install-hooks:
.PHONY: check
check:
pre-commit run --all-files
.PHONY: all
all: test check
+8 -6
View File
@@ -9,10 +9,11 @@ An example configuration would be as follows:
pipeline:
upload_debug:
image: vividboarder/drone-webdav
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
user: myusername
password: mypassword
settings:
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
user: myusername
password: mypassword
```
You probably don't want to check your credentials into your repo, so you may use secrets for this:
@@ -21,8 +22,9 @@ You probably don't want to check your credentials into your repo, so you may use
pipeline:
upload_debug:
image: vividboarder/drone-webdav
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
settings:
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
secrets:
- source: WEBDAV_USER
target: PLUGIN_USERNAME
+1 -1
View File
@@ -37,7 +37,7 @@ fi
while [ "${PLUGIN_ATTEMPTS}" -gt 0 ]; do
# Uploading the file
curl "${ARGS[@]}" --upload-file "$PLUGIN_FILE" "$PLUGIN_DESTINATION" && {
curl --fail-with-body --show-error --silent "${ARGS[@]}" --upload-file "$PLUGIN_FILE" "$PLUGIN_DESTINATION" && {
# Terminate the script as soon as the upload is successful
echo "[INFO] Upload was successful."
exit 0
+4 -4
View File
@@ -1,8 +1,8 @@
---
version: '2.4'
version: '3'
services:
webdav:
image: sashgorokhov/webdav
image: bytemark/webdav
environment:
USERNAME: jdoe
PASSWORD: hunter2
@@ -12,9 +12,9 @@ services:
context: ../
dockerfile: Dockerfile
volumes:
- './test.txt:/test.txt'
- '.:/test'
environment:
PLUGIN_FILE: '/test.txt'
PLUGIN_FILE: '/test/test{1,2}.txt'
PLUGIN_DESTINATION: 'http://webdav/'
PLUGIN_USERNAME: jdoe
PLUGIN_PASSWORD: hunter2
+6 -4
View File
@@ -1,17 +1,19 @@
---
version: '2.4'
version: '3'
services:
webdav:
image: sashgorokhov/webdav
image: bytemark/webdav
environment:
ANONYMOUS_METHODS: ALL
plugin:
build:
context: ../
dockerfile: Dockerfile
volumes:
- './test.txt:/test.txt'
- '.:/test'
environment:
PLUGIN_FILE: '/test.txt'
PLUGIN_FILE: '/test/test{1,2}.txt'
PLUGIN_DESTINATION: 'http://webdav/'
PLUGIN_TIMEOUT: 10
PLUGIN_ATTEMPTS: 4
View File
+1
View File
@@ -0,0 +1 @@
ohai