Skip to content

migration to github

migration to github #1

Workflow file for this run

name: release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
outputs:
needs_release: ${{ steps.repository_info.outputs.needs_release }}
version: ${{ steps.repository_info.outputs.VERSION }}
steps:
- uses: actions/checkout@v3
- name: setup eli
uses: alis-is/setup-eli@v1
- name: Generate env
id: repository_info
run: |
eli .github/get-variables.lua >> $GITHUB_OUTPUT
if git tag -l "$VERSION" | grep "$VERSION"; then
echo "Version $VERSION already exists";
else
echo "Found new version - $VERSION"
echo "NEEDS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Generate SHA256 and PACKAGE_SOURCE
if: ${{ steps.repository_info.outputs.NEEDS_RELEASE == 'true'}}
working-directory: src
run: |
zip ../${{ steps.repository_info.outputs.ID }}-${{steps.repository_info.outputs.VERSION}}.zip -r *
- name: Upload files to a GitHub release
uses: svenstaro/upload-release-action@2.2.1
if: ${{ steps.repository_info.outputs.NEEDS_RELEASE == 'true'}}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{steps.repository_info.outputs.VERSION}}
file: ${{ steps.repository_info.outputs.ID }}-${{steps.repository_info.outputs.VERSION}}.zip
- name: Generate SHA256 and PACKAGE_SOURCE
id: release_info
if: ${{ steps.repository_info.outputs.NEEDS_RELEASE == 'true'}}
env:
ID: ${{ steps.repository_info.outputs.ID }}
VERSION: ${{steps.repository_info.outputs.VERSION}}
run: |
export SHA256=$(sha256sum $ID-$VERSION.zip | awk '{print $1}')
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
export PACKAGE_SOURCE=https://github.com/${{github.repository}}/releases/download/$VERSION/$ID-$VERSION.zip
echo "PACKAGE_SOURCE=$PACKAGE_SOURCE" >> $GITHUB_OUTPUT
- name: Air Repository Dispatch
uses: peter-evans/repository-dispatch@v1
if: ${{ steps.repository_info.outputs.NEEDS_RELEASE == 'true'}}
with:
token: ${{ secrets.AIR_ACCESS_TOKEN }}
repository: alis-is/air
event-type: app-release
client-payload: '{ "id": "${{ steps.repository_info.outputs.ID }}", "repository": "${{github.repository}}", "version": "${{steps.repository_info.outputs.VERSION}}", "package": "${{ steps.release_info.outputs.PACKAGE_SOURCE }}", "sha256": "${{ steps.release_info.outputs.SHA256 }}"}'
build-containers:
runs-on: ubuntu-latest
needs: [build]
if: needs.build.outputs.needs_release == 'true'
steps:
- uses: actions/checkout@v3
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# TODO:
notify:
runs-on: ubuntu-latest
needs: [build, build-containers]
if: needs.build.outputs.needs_release == 'true'
steps:
- name: Notify new version available
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.XTZ_PACKAGES_DISCORD_WEBHOOK }}
with:
args: "New ${{github.repository}} - ${{ needs.build.outputs.version }} released. (<https://github.com/${{github.repository}}/releases/tag/${{ github.ref_name }}>)"