mirror of
https://github.com/ViViDboarder/drone-webdav.git
synced 2026-06-04 18:24:04 +08:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f3f05247a | |||
| 06beaed6ab | |||
| 73ee27f14e | |||
| 66ac1fa9a7 | |||
| 051ccd20e3 | |||
| 9fc797e244 | |||
| 30acb3ee44 | |||
| 95baa0b710 | |||
| d88042153f | |||
| 6dd4d6a367 | |||
| 6d0e68aeea | |||
| eaf8993535 | |||
| 55ea8f5fe7 | |||
| 7b236ca078 | |||
| 30febb63a3 |
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ohai
|
||||
Reference in New Issue
Block a user