Version v0.8.7. #43
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GHR_VERSION: 0.17.0 | |
IMAGE_NAME: index.docker.io/metacall/core | |
IMAGE_REGISTRY: index.docker.io | |
ARTIFACTS_PATH: ./build-artifacts | |
# GITHUB_TOKEN - From default secrets | |
# GITHUB_REPOSITORY - Default variable | |
jobs: | |
build: | |
name: Build the core | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Pull the Docker images | |
run: bash ./docker-compose.sh pull | |
- name: Build the Docker images | |
run: bash ./docker-compose.sh build | |
- name: Extract built artifacts | |
run: bash ./docker-compose.sh pack | |
- name: Upload built artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-artifacts | |
path: ${{ env.ARTIFACTS_PATH }}/ | |
release: | |
name: Release on GitHub | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # To fetch all tags | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: built-artifacts | |
path: ${{ env.ARTIFACTS_PATH }}/ | |
- name: Load GHR binary | |
run: | | |
curl -sL https://github.com/tcnksm/ghr/releases/download/v${GHR_VERSION}/ghr_v${GHR_VERSION}_linux_amd64.tar.gz | tar zx | |
chmod +x ghr_v${GHR_VERSION}_linux_amd64/ghr | |
mv ghr_v${GHR_VERSION}_linux_amd64/ghr /usr/local/bin | |
- name: Export variables | |
run: | | |
echo "GH_REPO_OWNER=${GITHUB_REPOSITORY_OWNER}" >> $GITHUB_ENV | |
echo "GH_REPO_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
export PREVIOUS_TAG=$(git describe HEAD^1 --abbrev=0 --tags) | |
echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV | |
echo "GIT_HISTORY<<EOF" >> $GITHUB_ENV | |
echo "$(git log --no-merges --format="- %s" ${PREVIOUS_TAG}..HEAD)" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Release on GitHub | |
run: | | |
if [[ "${PREVIOUS_TAG}" == "" ]]; then export GIT_HISTORY=$(git log --no-merges --format="- %s"); fi | |
export CI_COMMIT_TAG="${{ github.ref_name }}" | |
export RELEASE_DATE=$(date '+%Y-%m-%d') | |
echo "MetaCall ${CI_COMMIT_TAG} [${RELEASE_DATE}]" | |
ghr -t "${{ secrets.GITHUB_TOKEN }}" -u "${GH_REPO_OWNER}" -r "${GH_REPO_NAME}" -c "${GITHUB_SHA}" -n "MetaCall ${CI_COMMIT_TAG} [${RELEASE_DATE}]" -b "${GIT_HISTORY}" -replace "${CI_COMMIT_TAG}" "${PWD}/${{ env.ARTIFACTS_PATH }}/packages/" |