2020-11-21 19:19:21 +00:00
name : Publish Docker and WSL Images
2020-11-02 18:38:06 +00:00
on :
push :
2020-11-10 13:41:26 +00:00
branches :
- master
2020-11-02 18:38:06 +00:00
tags :
- v*
jobs :
build :
runs-on : ubuntu-latest
steps :
- name : Checkout
uses : actions/checkout@v2
- name : Set up QEMU
uses : docker/setup-qemu-action@v1
- name : Set up Docker Buildx
uses : docker/setup-buildx-action@v1
- name : Login to DockerHub
uses : docker/login-action@v1
with :
username : ${{ secrets.DOCKERHUB_USERNAME }}
password : ${{ secrets.DOCKERHUB_TOKEN }}
# Use the repository information of the checked-out code to format docker tags
- name : Docker meta
2020-11-02 21:12:58 +00:00
id : docker_meta
uses : crazy-max/ghaction-docker-meta@v1
with :
2020-11-16 03:29:36 +00:00
images : opendronemap/odm
2020-11-21 19:19:21 +00:00
tag-semver : |
{{version}}
2020-11-02 18:38:06 +00:00
- name : Build and push Docker image
id : docker_build
uses : docker/build-push-action@v2
with :
file : ./portable.Dockerfile
2020-11-08 17:45:13 +00:00
platforms : linux/amd64
2020-11-02 18:38:06 +00:00
push : true
2020-11-22 05:06:37 +00:00
tags : |
${{ steps.docker_meta.outputs.tags }}
opendronemap/odm:latest
2020-11-02 18:38:06 +00:00
- name : Export WSL image
id : wsl_export
2020-11-20 19:10:03 +00:00
run : |
2020-11-16 03:29:36 +00:00
docker pull opendronemap/odm
docker export $(docker create opendronemap/odm) --output odm-wsl-rootfs-amd64.tar.gz
2020-11-02 18:38:06 +00:00
gzip odm-wsl-rootfs-amd64.tar.gz
echo ::set-output name=amd64-rootfs::"odm-wsl-rootfs-amd64.tar.gz"
2020-11-10 13:41:26 +00:00
# Convert tag into a GitHub Release if we're building a tag
2020-11-02 18:38:06 +00:00
- name : Create Release
2020-11-10 13:41:26 +00:00
if : github.event_name == 'tag'
2020-11-02 18:38:06 +00:00
id : create_release
uses : actions/create-release@v1
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
with :
tag_name : ${{ github.ref }}
release_name : Release ${{ github.ref }}
draft : false
prerelease : false
2020-11-10 13:41:26 +00:00
# Upload the WSL image to the new Release if we're building a tag
2020-11-02 18:38:06 +00:00
- name : Upload amd64 Release Asset
2020-11-10 13:41:26 +00:00
if : github.event_name == 'tag'
2020-11-02 18:38:06 +00:00
id : upload-amd64-wsl-rootfs
uses : actions/upload-release-asset@v1
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
with :
upload_url : ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path : ./${{ steps.wsl_export.outputs.amd64-rootfs }}
asset_name : ${{ steps.wsl_export.outputs.amd64-rootfs }}
asset_content_type : application/gzip
2020-11-10 13:41:26 +00:00
# Always archive the WSL rootfs
- name : Upload amd64 Artifact
uses : actions/upload-artifact@v2
with :
name : wsl-rootfs
path : ${{ steps.wsl_export.outputs.amd64-rootfs }}
2020-11-02 18:38:06 +00:00
- name : Docker image digest and WSL rootfs download URL
run : |
echo "Docker image digest: ${{ steps.docker_build.outputs.digest }}"
echo "WSL AMD64 rootfs URL: ${{ steps.upload-amd64-wsl-rootfs.browser_download_url }}"
2020-11-10 13:41:26 +00:00