Merge pull request #407 from atlas-bi/dev #143
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: | |
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 |