🦀 #5
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: 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 }} |