Skip to content

Merge pull request #407 from atlas-bi/dev #143

Merge pull request #407 from atlas-bi/dev

Merge pull request #407 from atlas-bi/dev #143

Workflow file for this run

name: πŸš€ Release
on:
push:
branches: [main, alpha]
jobs:
release:
runs-on: ubuntu-latest
outputs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
last_release_version: ${{ steps.semantic.outputs.last_release_version }}
steps:
- name: πŸ’Ύ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: 🧹 Cleanup apt list
uses: christopherpickering/[email protected]
- name: βŽ” Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: πŸ“₯ Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: 🎢 Setup Poetry
uses: snok/install-poetry@v1
- name: πŸš€ Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
- name: πŸ“¦ Packaging Install deps
if: steps.semantic.outputs.new_release_published == 'true'
run: |
sudo apt-get update
sudo apt-get install dh-make devscripts dpkg-dev gzip apt-utils -y
- name: πŸ—οΈ Load GPG Keys
if: steps.semantic.outputs.new_release_published == 'true'
run: |
# gpg --export-secret-keys <key id> | base64
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
env:
GPG_SIGNING_KEY: ${{ secrets.PPA_GPG_SECRET }}
- name: πŸ’Ύ Checkout
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/checkout@v3
with:
persist-credentials: false
path: atlas
- name: πŸ—οΈ Build .deb
if: steps.semantic.outputs.new_release_published == 'true'
run: |
cd ./atlas/packages
cp -r "atlas-hub-<version>" "atlas-hub-$VERSION"
cd "atlas-hub-$VERSION"
find . -type f -name "*" -exec sed -i'' -e "s/<version>/$VERSION/g" {} +
echo "building"
debuild --no-tgz-check -us -uc
cd ..
ls
env:
VERSION: ${{ steps.semantic.outputs.new_release_version }}
- name: πŸ’Ύ Checkout PPA
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
repository: atlas-bi/ppa
token: ${{ secrets.PPA_REPO_PAT }}
path: ppa
- name: πŸ‘ Move deb to PPA
if: github.ref_name == 'main' && steps.semantic.outputs.new_release_published == 'true'
run: |
cp ./atlas/packages/*.deb ./ppa/deb/pool/stable
- name: πŸ‘ Move alpha deb to PPA
if: github.ref_name == 'alpha' && steps.semantic.outputs.new_release_published == 'true'
run: |
cp ./atlas/packages/*.deb ./ppa/deb/pool/unstable
- name: πŸ’Ύ Commit changes
if: steps.semantic.outputs.new_release_published == 'true'
run: |
cd ./ppa
git config --local user.name "$USER"
git config --local user.email "$EMAIL"
git add .
git commit -m "added atlas-hub $VERSION"
env:
VERSION: ${{ steps.semantic.outputs.new_release_version }}
USER: ${{ secrets.GIT_USER }}
EMAIL: ${{ secrets.GIT_EMAIL }}
- name: πŸ€™ Push changes
if: steps.semantic.outputs.new_release_published == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PPA_REPO_PAT }}
branch: master
directory: ppa
repository: atlas-bi/ppa
# validate-latest:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - name: Sleep for 5 mins for apt to update
# run: sleep 300s
# shell: bash
# - name: update apt list
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# sudo apt update
# sudo apt install curl gnupg2
# curl -s "https://packages.atlas.bi/scripts/deb.sh" | sudo bash -
# # add alpha builds
# echo "deb [arch=all] https://packages.atlas.bi/deb/ ./unstable main" | sudo tee -a /etc/apt/sources.list.d/atlas.list
# sudo apt update
# - name: install
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.new_release_version }}
# - name: check install is online
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# curl https://raw.githubusercontent.com/orangemug/bash-assert/master/assert.sh > assert.sh
# source ./assert.sh
# assert $(curl -s -o /dev/null -w "%{http_code}" localhost/login) -eq 200
# # we can login?
# if [[ ! $(curl -X POST localhost/login?user=admin 2> /dev/null | grep -oP href=\"/\") == href=\"/\" ]]; then exit 1; fi
# - name: uninstall
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt remove atlas-hub
# validate-upgrade:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - name: Sleep for 5 mins for apt to update
# run: sleep 300s
# shell: bash
# - name: update apt list
# if: needs.release.outputs.new_release_published == 'true'
# run: |
# sudo apt update
# sudo apt install curl gnupg2
# curl -s "https://packages.atlas.bi/scripts/deb.sh" | sudo bash -
# # add alpha builds
# echo "deb [arch=all] https://packages.atlas.bi/deb/ ./unstable main" | sudo tee -a /etc/apt/sources.list.d/atlas.list
# sudo apt update
# - name: install
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.last_release_version }}
# - name: upgrade
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt install -y atlas-hub=$VERSION
# env:
# VERSION: ${{ needs.release.outputs.new_release_version }}
# - name: uninstall
# if: needs.release.outputs.new_release_published == 'true'
# run: sudo apt remove atlas-hub