Initial commit #1
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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
auto_ralease: | |
name: auto create and push release | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: cachix/install-nix-action@v27 | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Generate Release version from date | |
id: date | |
run: | | |
TAG_NAME="release-$(date +'%Y.%m.%d-%H.%M.%S')" | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
echo "Tag name will be: $TAG_NAME" | |
- name: Generate tar.gz from src | |
id: generate_tar | |
run: | | |
PKG_NAME="$(basename "${{ github.repository }}" | sed 's/pkg-//g')" | |
FILE_NAME="src-${PKG_NAME}.tar.gz" | |
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV | |
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV | |
tar -czvf ${FILE_NAME} src/ | |
FILE_HASH=$(sha256sum ${FILE_NAME} | cut -d ' ' -f 1) | |
echo "FILE_HASH=$FILE_HASH" >> $GITHUB_ENV | |
- name: Generate package.nix | |
id: generate_package | |
run: | | |
URL=$(echo \ | |
"https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/${{ env.FILE_NAME }}" \ | |
| sed 's/\//\\\//g' | |
) | |
SRC="src = fetchurl {\n url = \"${URL}\";\n sha256 = \"${{ env.FILE_HASH }}\";\n }" | |
sed -i "s/src = .\/src/src = .\/${{ env.FILE_NAME }}/g" ./package.nix | |
git add ./${{ env.FILE_NAME }} | |
nix build | |
git reset ./${{ env.FILE_NAME }} | |
sed -i "s/src = .\/${{ env.FILE_NAME }}/${SRC}/g" ./package.nix | |
sed -i "s/version = \".*\";/version = \"${{ env.TAG_NAME }}\";/g" ./package.nix | |
sed -i "1s/.*/{\n fetchurl,/" ./package.nix | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ env.TAG_NAME }} | |
tag_name: ${{ env.TAG_NAME }} | |
prerelease: false | |
files: | | |
./${{ env.FILE_NAME }} | |
./package.nix | |
- name: Clone RevoluNixPKGS | |
uses: actions/checkout@master | |
with: | |
ref: testing | |
repository: RevoluNix/revolunixpkgs | |
token: ${{ secrets.RevoluNixPKGS_TOKEN }} | |
- name: Update RevoluNixPKGS | |
id: update_pkgs | |
run: | | |
git config --global user.email "${{ github.event.pusher.email }}" | |
git config --global user.name "${{ github.event.pusher.name }}" | |
URL="https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/package.nix" | |
rm -rf ./pkgs/${{ env.PKG_NAME }} | |
mkdir -p ./pkgs/${{ env.PKG_NAME }} | |
wget -O ./pkgs/${{ env.PKG_NAME }}/package.nix $URL | |
git add . | |
git commit -m "feat: Update/Upload ${{ env.PKG_NAME }} package" | |
- name: Push RevoluNixPKGS changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.RevoluNixPKGS_TOKEN }} | |
repository: RevoluNix/revolunixpkgs | |
branch: testing |