Skip to content

Commit

Permalink
add gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
robherley committed Feb 27, 2022
1 parent eebe891 commit 72508ec
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on: [push]

jobs:
release:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
outputs:
release_id: ${{ steps.release.outputs.release_id }}
steps:
- name: Make release
id: release
uses: actions/github-script@v5
with:
script: |
const tag_name = context.ref.replace("refs/tags/", "")
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name
})
core.setOutput('release_id', release.data.id);
docker-image:
runs-on: ubuntu-latest
needs: release
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to cr
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 72508ec

Please sign in to comment.