fix: correct release tag id #9
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: "Semantic release" | |
on: | |
push: | |
branches: | |
- main | |
- alpha | |
- beta | |
- next | |
concurrency: | |
group: release-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
name: Set environment variables | |
runs-on: ubuntu-latest | |
outputs: | |
DEPLOY_ENVIRONMENT: ${{ steps.env.outputs.DEPLOY_ENVIRONMENT }} | |
steps: | |
- name: "☁️ compute environment variables" | |
id: env | |
run: | | |
echo "DEPLOY_ENVIRONMENT=$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo ${{ github.ref_name }})" >> $GITHUB_OUTPUT | |
test: | |
name: Test and lint | |
uses: ./.github/workflows/development.yml | |
docker: | |
name: Build container | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v4 | |
- name: "🔧 setup buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "🔧 cache docker layers" | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: "🔧 docker meta" | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ github.repository }} | |
tags: latest | |
- name: "📦 docker build" | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=docker,dest=/tmp/docker.tar | |
push: false | |
cache-from: type=gha, scope=${{ github.workflow }} | |
cache-to: type=gha, scope=${{ github.workflow }} | |
- name: "📂 docker artifacts" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docker | |
path: /tmp/docker.tar | |
release: | |
environment: | |
name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }} | |
url: https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic-release.outputs.release-tag }} | |
outputs: | |
release-tag: ${{ steps.semantic-release.outputs.release-tag }} | |
name: Semantic release | |
needs: | |
- setup | |
- test | |
- docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "🔧 setup node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: "🔧 install npm@latest" | |
run: npm i -g npm@latest | |
- name: "📦 install dependencies" | |
uses: bahmutov/npm-install@v1 | |
- name: "📂 download docker artifacts" | |
uses: actions/download-artifact@v3 | |
with: | |
name: docker | |
path: /tmp | |
- name: "📦 load tag" | |
run: | | |
docker load --input /tmp/docker.tar | |
docker image ls -a | |
- name: "🚀 release" | |
id: semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npx semantic-release | |
- name: "echo outputs" | |
run: | | |
echo "RELEASE_TAG: ${{ env.RELEASE_TAG }}" | |
echo "RELEASE_VERSION: ${{ env.RELEASE_VERSION }}" | |
echo "outputs.release-tag: ${{ steps.semantic-release.outputs.release-tag }}" | |
echo "outputs.release-version: ${{ steps.semantic-release.outputs.release-version }}" | |
cleanup: | |
name: Cleanup actions | |
needs: | |
- release | |
runs-on: ubuntu-latest | |
steps: | |
- name: "♻️ remove build artifacts" | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: | | |
docker |