Skip to content

fix: add autostart support #862

fix: add autostart support

fix: add autostart support #862

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: publish
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
- name: setup git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Install yarn
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn
- name: Install Packages
run: yarn
- name: Compile ESM
run: yarn tsc -b packages/tsconfig.esm.json
- name: Compile CJS
run: yarn tsc -b packages/tsconfig.cjs.json
#- name: Linting
# uses: wearerequired/lint-action@v2
# with:
# eslint: true
- name: Ensure CJS
run: yarn workspaces foreach -Ap --no-private --include "@akala/config|@akala/core|@akala/json-rpc-ws|@akala/cli|@akala/commands" exec "echo '{"'"type":"commonjs"}'"' > dist/cjs/package.json"
- name: publish updates
run: node packages/automate/dist/esm/cli.js --loader @akala/automate-yamlloader --file @akala/semantic-release/publish.yml --verbose=silly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
DEBUG_DEPTH: 4
docker:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Prepare
id: prepare
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/main ]]; then
echo version=latest >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/* ]]; then
echo version=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT
else
echo version=snapshot >> $GITHUB_OUTPUT
fi
echo build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') >> $GITHUB_OUTPUT
# echo docker_platforms=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 >> $GITHUB_OUTPUT
echo docker_platforms=linux/amd64,linux/arm64/v8 >> $GITHUB_OUTPUT
echo docker_image=${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Docker Setup Buildx
uses: docker/[email protected]
- name: Environment
run: |
echo home=$HOME
echo git_ref=$GITHUB_REF
echo git_sha=$GITHUB_SHA
echo version=${{ steps.prepare.outputs.version }}
echo date=${{ steps.prepare.outputs.build_date }}
echo image=${{ steps.prepare.outputs.docker_image }}
echo platforms=${{ steps.prepare.outputs.docker_platforms }}
echo avail_platforms=${{ steps.buildx.outputs.platforms }}
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v4
- name: Docker Buildx (no push)
run: |
docker buildx build \
--platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=false" \
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
--file docker/Dockerfile docker
- name: Docker Login
if: success()
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Docker Buildx (push)
if: success()
run: |
docker buildx build \
--platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=true" \
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
--file docker/Dockerfile docker
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json