31 lines
957 B
YAML
31 lines
957 B
YAML
name: "Build and publish image"
|
|
on:
|
|
push:
|
|
branches: ["master"]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- name: "Checkout repository"
|
|
uses: "actions/checkout@v2"
|
|
- name: "Login with Github packages"
|
|
uses: "docker/login-action@v1"
|
|
with:
|
|
registry: "ghcr.io"
|
|
username: "${{ github.repository_owner }}"
|
|
password: "${{ secrets.GITHUB_TOKEN }}"
|
|
- name: "Set up buildx"
|
|
uses: "docker/setup-buildx-action@v1"
|
|
- name: "Extract branch name"
|
|
shell: "bash"
|
|
run: "echo \"##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})\""
|
|
id: "extract_branch"
|
|
- name: "Build and push image"
|
|
uses: "docker/build-push-action@v2"
|
|
with:
|
|
context: "./"
|
|
file: "./Dockerfile"
|
|
push: true
|
|
tags: "ghcr.io/${{ github.repository_owner }}/iot-weather:${{ steps.extract_branch.outputs.branch }}"
|