Merge branch 'master' into galactic #550
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
name: Docker Builder CI | |
# Reference: | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on | |
on: [push, pull_request, workflow_dispatch] | |
# https://github.com/docker/build-push-action | |
jobs: | |
# https://github.com/docker/build-push-action/issues/225 | |
docker: | |
name: "Build Docker image develop" | |
runs-on: ubuntu-latest #self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md | |
- name: Docker meta | |
id: meta | |
uses: crazy-max/[email protected] | |
with: | |
images: nanosaur/nanosaur | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=ref,event=tag | |
- 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 | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/[email protected] | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Docker Image digest | |
run: | | |
echo ${{ steps.docker_build.outputs.digest }} | |
export: | |
name: Make all artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Build project # This would actually build your project, using zip for an example artifact | |
run: | | |
bash nanosaur_description/scripts/nanosaur_stl.sh | |
- name: upload results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: data | |
path: nanosaur_stl.zip | |
# https://github.com/peter-evans/dockerhub-description | |
update_docker_description: | |
name: Update docker description | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [docker] | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: nanosaur/nanosaur | |
short-description: ${{ github.event.repository.description }} | |
readme-filepath: ./README.md | |
release_stl: | |
name: Upload release | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [export] | |
steps: | |
- name: Extract artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: data | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
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: ./nanosaur_stl.zip | |
asset_name: nanosaur_stl.zip | |
asset_content_type: application/zip | |
notify: | |
name: "Notify socials" | |
needs: [release_stl, update_docker_description] | |
runs-on: ubuntu-latest #self-hosted | |
steps: | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed.' |