-
Notifications
You must be signed in to change notification settings - Fork 58
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
51 changed files
with
5,870 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,88 @@ | ||
#!/bin/bash | ||
|
||
main() { | ||
local repo="${1?Need repo}" | ||
local gist="${2?Need gist}" | ||
local readme_context="${3?Need build context}" | ||
local readme_main="${4?Need readme main part}" | ||
local readme_append=${5?Need readme append template} | ||
|
||
local api_base_url="https://hub.docker.com/v2" | ||
local deployment_repo | ||
local readme_main_file="${PWD}/${readme_context}/${readme_main}" | ||
local readme_append_file="${PWD}/${readme_context}/${readme_append}" | ||
local scrap_append_file="${PWD}/${readme_context}/scrap-append.tmp" | ||
local readme_upload_file="${PWD}/${readme_context}/scrap-readme.md" | ||
local repo_name | ||
local repo_owner | ||
local response | ||
local user_name="${DOCKERHUB_USERNAME}" | ||
local user_pwd="${DOCKERHUB_PASSWORD}" | ||
local token | ||
|
||
if [ ! -f "${readme_main_file}" ] ; then | ||
echo "File not found: '${readme_main_file}'" | ||
return 1 | ||
fi | ||
if [ ! -f "${readme_append_file}" ] ; then | ||
echo "File not found: '${readme_append_file}'" | ||
return 1 | ||
fi | ||
|
||
### extract the repo owner and its name | ||
### alternative 1 | ||
repo_name="$(basename $repo)" | ||
repo_owner="$(basename $(dirname ${repo}))" | ||
### alternative 2 | ||
# repo_name="${repo##*/}" | ||
# repo_owner="${repo%$repo_name}" ; repo_owner="${repo_owner::-1}" ; repo_owner="${repo_owner##*/}" | ||
### also ensure that the deployment repo has only two parts like 'repo_owner/repo_name' | ||
# deployment_repo="$(basename $(dirname ${repo}))/$(basename ${repo})" | ||
deployment_repo="${repo_owner}/${repo_name}" | ||
|
||
### create the actual README file for Docker Hub by replacing the variables in the append-template (badge links) | ||
### and appending it to the main-readme partial file | ||
### it is expected that the readme include template contains the following variables: | ||
### ${OWNER} - owner of the deployment repository and also the related deployment gist | ||
### ${GIST} - gist containing the badge endpoints | ||
### ${REPO} - name of the deployment repository | ||
|
||
### replace the environment variables in the template | ||
$( OWNER="${repo_owner}" GIST="${gist}" REPO="${repo_name}" envsubst < "${readme_append_file}" > "${scrap_append_file}" ) | ||
|
||
### append the updated template to the main readme part | ||
cat "${readme_main_file}" "${scrap_append_file}" > "${readme_upload_file}" | ||
|
||
# get token to be able to talk to Docker Hub | ||
echo "GET token" | ||
token=$( curl -s \ | ||
-X POST \ | ||
"${api_base_url}/users/login/" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"username": "'${user_name}'", "password": "'${user_pwd}'"}' | sed -e 's/.*"token": "\(.*\)".*/\1/' ) | ||
|
||
echo "UPDATE Docker Hub using template '${readme_template_name}'" | ||
response=$( curl -s \ | ||
-X PATCH \ | ||
"${api_base_url}/repositories/${deployment_repo}/" \ | ||
-H "Authorization: JWT ${token}" \ | ||
--write-out %{response_code} \ | ||
--output /dev/null \ | ||
--data-urlencode "full_description@${readme_upload_file}" ) | ||
|
||
if [ ${response} -eq 200 ] ; then | ||
echo "${response}. UPDATE success." | ||
return 0 | ||
else | ||
echo "ERROR: ${response}. Unable to UPDATE Docker Hub description." | ||
echo user_name="${user_name}" | ||
echo deployment_repo="${deployment_repo}" | ||
echo readme_upload_file=${readme_upload_file} | ||
echo api_base_url=${api_base_url} | ||
echo "curl -H "Authorization: JWT ${token}" -X PATCH --data-urlencode full_description@${readme_upload_file} ${api_base_url}/repositories/${deployment_repo}/" | ||
curl -v -H "Authorization: JWT ${token}" -X PATCH --data-urlencode full_description@${readme_upload_file} ${api_base_url}/repositories/${deployment_repo}/ | ||
return 1 | ||
fi | ||
} | ||
|
||
main $@ |
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,44 @@ | ||
### This workflow triggers auto-building on Docker Hub. | ||
name: dockerhub-autobuild | ||
on: | ||
release: | ||
### published: a release, pre-release, or draft of a release is published | ||
### unpublished: a release or pre-release is deleted | ||
### created: a draft is saved, or a release or pre-release is published without previously being saved as a draft | ||
### edited: a release, pre-release, or draft release is edited | ||
### deleted: a release, pre-release, or draft release is deleted | ||
### prereleased: a pre-release is created | ||
### released: a release or draft of a release is published, or a pre-release is changed to a release | ||
types: [published] | ||
schedule: | ||
### * is a special character in YAML so you have to quote this string | ||
### every 5 minutes (for testing only) | ||
# - cron: '*/5 * * * *' | ||
### at 03:15 on every Sunday | ||
- cron: '15 3 * * 0' | ||
jobs: | ||
call-dockerhub: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Report trigger | ||
### "tag_name": "v1.0.0", | ||
### "target_commitish": "master", | ||
### "name": "v1.0.0", | ||
### "body": "Description of the release", | ||
### "draft": false, | ||
### "prerelease": false, | ||
### "created_at": "2013-02-27T19:35:32Z", | ||
### "published_at": "2013-02-27T19:35:32Z", | ||
shell: bash | ||
run: | | ||
echo "Event name: ${{ github.event_name }}" | ||
echo "Release branch: ${{ github.event.release.target_commitish }}" | ||
echo "Release tag: ${{ github.event.release.tag_name }}" | ||
echo "Is draft: ${{ github.event.release.draft }}" | ||
echo "Is prerelease: ${{ github.event.release.prerelease }}" | ||
echo "Created at: ${{ github.event.release.created_at }}" | ||
- name: Call webhook | ||
shell: bash | ||
run: | | ||
echo "Call webhook" | ||
curl -X POST -s -o /dev/null --write-out "%{http_code}" ${{ secrets.DockerHubWebhookBuildRelease }} |
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,59 @@ | ||
### This workflow can be optionally triggered by Docker Hub after pushing an image. | ||
name: dockerhub-post-push | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repo: | ||
required: true | ||
default: '(repo not provided)' | ||
tag: | ||
required: true | ||
default: '(tag not provided)' | ||
gist: | ||
required: true | ||
default: '(gist not provided)' | ||
readme_context: | ||
required: true | ||
default: '(readme context not provided)' | ||
created: | ||
required: true | ||
default: '(created not provided)' | ||
version_sticker: | ||
required: true | ||
default: '(version_sticker not provided)' | ||
version_sticker_verbose: | ||
required: true | ||
default: '(version_sticker_verbose not provided)' | ||
jobs: | ||
dockerhub-callback: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Report trigger | ||
shell: bash | ||
run: | | ||
echo "Event: ${{ github.event_name }}" | ||
echo "Repo: ${{ github.event.inputs.repo }}" | ||
echo "Tag: ${{ github.event.inputs.tag }}" | ||
echo "Gist: ${{ github.event.inputs.gist }}" | ||
echo "Readme context: ${{ github.event.inputs.readme_context }}" | ||
echo "Created at: ${{ github.event.inputs.created }}" | ||
echo "Version sticker: ${{ github.event.inputs.version_sticker }}" | ||
echo -e "Version sticker verbose:\n${{ github.event.inputs.version_sticker_verbose }}" | ||
dockerhub-description: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Publish Docker Hub description | ||
shell: bash | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
run: | | ||
chmod +x .github/workflows/deploy-readme.sh | ||
sleep 60 | ||
.github/workflows/deploy-readme.sh \ | ||
"${{ github.event.inputs.repo }}" \ | ||
"${{ github.event.inputs.gist }}" \ | ||
"${{ github.event.inputs.readme_context }}" \ | ||
"README-dockerhub.md" \ | ||
"readme-append.template" |
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,25 @@ | ||
# CHANGELOG | ||
|
||
## Project `accetto/ubuntu-vnc-xfce-g3` | ||
|
||
[Docker Hub][this-docker] - [Git Hub][this-github] - [Wiki][this-wiki] | ||
|
||
*** | ||
|
||
### Release 20.12 | ||
|
||
- Initial release | ||
- **xfce** into [accetto/ubuntu-vnc-xfce-g3][accetto-ubuntu-vnc-xfce-g3] | ||
- **xfce-chromium** into [accetto/ubuntu-vnc-xfce-chromium-g3][accetto-ubuntu-vnc-xfce-chromium-g3] | ||
- **xfce-firefox** into [accetto/ubuntu-vnc-xfce-firefox-g3][accetto-ubuntu-vnc-xfce-firefox-g3] | ||
|
||
*** | ||
|
||
[this-docker]: https://hub.docker.com/u/accetto/ | ||
|
||
[this-github]: https://github.com/accetto/ubuntu-vnc-xfce-g3/ | ||
[this-wiki]: https://github.com/accetto/ubuntu-vnc-xfce-g3/wiki | ||
|
||
[accetto-ubuntu-vnc-xfce-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-g3 | ||
[accetto-ubuntu-vnc-xfce-chromium-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-chromium-g3 | ||
[accetto-ubuntu-vnc-xfce-firefox-g3]: https://hub.docker.com/r/accetto/ubuntu-vnc-xfce-firefox-g3 |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 accetto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.