fix #454
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- fix-release-workflow | |
concurrency: release | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
steps: | |
################################################### | |
# | |
# Prepare | |
# | |
################################################### | |
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449 | |
- name: (PREPARE) Free space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache | |
- name: (PREPARE) Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: (PREPARE) Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: (PREPARE) Setup Apt Packages | |
uses: awalsh128/[email protected] | |
with: | |
packages: graphviz | |
- name: (PREPARE) Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.15.0 | |
cache: yarn | |
- name: (PREPARE) Install Dependencies | |
run: ./task install | |
- name: (PREPARE) Build Tasks | |
run: ./task tasks:build | |
- name: (PREPARE) Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.13 | |
cache: pip | |
- name: (PREPARE) Cache xOpera | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/opera | |
key: xopera | |
- name: (PREPARE) Install xOpera | |
run: ./src/assets/scripts/install-xopera.sh | |
- name: (PREPARE) Build Project | |
run: ./task build | |
- name: (PREPARE) Pull Example Dependencies | |
run: ./task examples:pull | |
################################################### | |
# | |
# Test | |
# | |
################################################### | |
- name: (TEST) Check ESLint | |
run: ./task lint:check | |
- name: (TEST) Check Prettier | |
run: ./task style:check | |
- name: (TEST) Check Dependencies | |
run: ./task licenses:check | |
- name: (TEST) Check Service Templates | |
run: ./task puccini:check | |
- name: (TEST) Run Tests | |
run: ./task test | |
- name: (TEST) Upload Tests to Codacy | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: coverage/lcov.info | |
################################################### | |
# | |
# Package | |
# | |
################################################### | |
- name: (PACKAGE) Setup Packaging Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pkg-cache | |
key: pkg | |
- name: (PACKAGE) Package Binaries | |
run: ./task package | |
- name: (PACKAGE) Import Signing Key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.VINTNER_RELEASE_PRIVATE_KEY }} | |
- name: (PACKAGE) Sign Binaries | |
run: | | |
cd dist | |
for BINARY in vintner-alpine-x64 vintner-linux-arm64 vintner-linux-x64 vintner-win-x64.exe | |
do | |
gpg --no-tty --detach-sign -a --local-user vintner-release ${BINARY} | |
done | |
- name: (PACKAGE) Checksum Binaries | |
run: | | |
cd dist | |
for BINARY in vintner-alpine-x64 vintner-linux-arm64 vintner-linux-x64 vintner-win-x64.exe | |
do | |
sha256sum --binary ${BINARY} > ${BINARY}.sha256 | |
done | |
- name: (PACKAGE) Compress Binaries | |
run: | | |
cd dist | |
for BINARY in vintner-alpine-x64 vintner-linux-arm64 vintner-linux-x64 vintner-win-x64.exe | |
do | |
tar -cJf ${BINARY}.xz ${BINARY} | |
done | |
- name: (PACKAGE) Compress Examples | |
run: tar -czvf ./dist/examples.tar.gz -C examples . | |
################################################### | |
# | |
# Release | |
# | |
################################################### | |
- name: (RELEASE) Delete Latest Release | |
run: gh release delete latest --cleanup-tag --yes || true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: (RELEASE) Delete Latest Tag (Local) | |
run: git tag --delete latest || true | |
- name: (RELEASE) Create Latest Release | |
run: gh release create latest --target ${GITHUB_SHA} --latest -t "Latest Release" -n "This is the latest release of this project" ./dist/* docs/docs/vintner-release.gpg | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
################################################### | |
# | |
# Docs | |
# | |
################################################### | |
- name: (DOCS) Setup Git | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}" | |
- name: (DOCS) Install Dependencies | |
run: ./task docs:install | |
- name: (DOCS) Generate Dependencies Page | |
run: ./task docs:generate:dependencies | |
- name: (DOCS) Generate Interface Page | |
run: ./task docs:generate:interface | |
- name: (DOCS) Generate Variability4TOSCA Conformance Test Pages | |
run: ./task docs:generate:variability | |
- name: (DOCS) Generate Queries4TOSCA Conformance Test Pages | |
run: ./task docs:generate:query | |
- name: (DOCS) Generate TOSCA SofDCar Profile Page | |
run: ./task docs:generate:sofdcar | |
- name: (DOCS) Generate TOSCA Vintner Profile Page | |
run: ./task docs:generate:normative | |
- name: (DOCS) Generate Technology Rules | |
run: ./task docs:generate:rules | |
- name: (DOCS) Build and Deploy Docs | |
run: ./task docs:deploy | |
- name: (RELEASE) Archive docs | |
run: tar -czvf docs.tar.gz -C docs/site/ . | |
- name: (RELEASE) Upload docs, profiles, and rules to release | |
run: gh release upload latest docs.tar.gz docs/docs/sofdcar/tosca-sofdcar-*.yaml docs/docs/normative/tosca-vintner-*.yaml docs/docs/variability4tosca/rules/technology-rules.yaml | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
################################################### | |
# | |
# Docker | |
# | |
################################################### | |
- name: (DOCKER) Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: (DOCKER) Log in to the container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: (DOCKER) Build Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: docker/Dockerfile | |
load: true | |
tags: ghcr.io/opentosca/opentosca-vintner:latest,ghcr.io/opentosca/opentosca-vintner:${{ github.sha }} | |
cache-from: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache | |
cache-to: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache,mode=max | |
- name: (DOCKER) Push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: true | |
tags: ghcr.io/opentosca/opentosca-vintner:latest | |
cache-from: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache | |
cache-to: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache,mode=max | |
- name: (RELEASE) Save docker image as tar ball | |
run: docker save ghcr.io/opentosca/opentosca-vintner:${{ github.sha }} | gzip > docker-image.tar.gz | |
- name: (RELEASE) Upload Docker image to release | |
run: gh release upload latest docker-image.tar.gz | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |