solutions/.github/workflows/build-push-template.yml

50 lines
1.6 KiB
YAML
Raw Normal View History

2020-06-17 12:16:26 +00:00
name: Build and Push template
on:
push:
branches:
- master
jobs:
build-push-template:
2020-08-20 13:00:53 +00:00
if: ${{ github.repository == 'substrate-developer-hub/substrate-node-template' }}
2020-06-17 12:16:26 +00:00
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build and push the node-template Docker image
uses: docker/build-push-action@v1 # https://github.com/docker/build-push-action
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: .devcontainer/Dockerfile
repository: paritytech/substrate-playground-template-node-template
2020-06-17 12:16:26 +00:00
tags: latest
add_git_labels: true
tag_with_ref: true
tag_with_sha: true
- run: echo ::set-output name=image::paritytech/substrate-playground-template-node-template:sha-${GITHUB_SHA::7}
2020-06-17 12:16:26 +00:00
id: env
- name: Update devcontainer.json
run: |-
t=$(mktemp)
cat .devcontainer/devcontainer.json | jq ".image = \"${{ steps.env.outputs.image }}\"" > ${t} && mv ${t} .devcontainer/devcontainer.json
- name: Commit .devcontainer.json update
uses: EndBug/add-and-commit@v4
with:
message: ":bookmark: update image"
add: ".devcontainer/devcontainer.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger playground inclusion
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: paritytech/substrate-playground
event-type: template-updated
2020-08-20 13:00:53 +00:00
client-payload: '{"id": "node-template", "image": "${{ steps.env.outputs.image }}"}'