Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build action #10

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release
on:
release:
types: [published]

jobs:
build:
name: Release
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
# workaround as there is no way to get the Release name or just the tag name by itself
- name: Extract branch name
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
id: extract_tag
- name: Build Lab Image
env:
VERSION: ${{ steps.extract_tag.outputs.tag }}
run: |
make build version=$VERSION
- name: Prune dangling images
run: docker image prune -f
- name: Login to GitHub Package Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish version to GitHub Package Registry
env:
VERSION: ${{ steps.extract_tag.outputs.tag }}
run: |
make release version=$VERSION
- name: Upload Release Assets
uses: AButler/upload-release-assets@v2.0
with:
files: './build/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!make
include Makefile.env

# Put it first so that "make" without argument is like "make help".
build: docker-build
release: docker-build docker-release

.PHONY: docker-build docker-release

docker-build:
docker build --build-arg VERSION="${version}" \
-t "${CONTAINER_REPOSITORY}:${version}" \
-t "${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version}" \
.
docker image prune -f

docker-release:
docker push ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version}
5 changes: 5 additions & 0 deletions Makefile.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NAME = markdown-to-confluence
IMAGE_SOURCE = https://github.com/vmware-tanzu-labs/markdown-to-confluence
CONTAINER_REGISTRY = ghcr.io/vmware-tanzu-labs
CONTAINER_REPOSITORY = markdown-to-confluence
version = latest
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GitPython==3.1.32
mistune==2.0.4
PyYAML==6.0
PyYAML==6.0.1
requests==2.31.0