From 0e57658b37a9f6fa379d1881f1b4dcd23f298894 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Mon, 25 Oct 2021 19:29:29 +0300 Subject: [PATCH 1/5] workflows: Add workflow to automatically update LineageOS --- .github/workflows/lineageos-update.yaml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/lineageos-update.yaml diff --git a/.github/workflows/lineageos-update.yaml b/.github/workflows/lineageos-update.yaml new file mode 100644 index 00000000..bda20dab --- /dev/null +++ b/.github/workflows/lineageos-update.yaml @@ -0,0 +1,37 @@ +name: "Update LineageOS" + +on: { schedule: [{ cron: '0 0 * * 0' }], workflow_dispatch } + +jobs: + updates: + name: "Update LineageOS" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.5 + - uses: cachix/install-nix-action@v14.1 + with: + install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211019_4a2b7cc/install + extra_nix_config: "experimental-features = nix-command flakes" + - name: "Set OLD_BUILD_NUMBER variable" + run: echo "OLD_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV + - name: "Fetch latest lineage-18.1 changes" + run: nix develop -c ./flavors/lineageos/update.sh lineage-18.1 + - name: "Fetch latest lineage-17.1 changes" + run: nix develop -c ./flavors/lineageos/update.sh lineage-17.1 + - name: "Update buildDateTime" + run: sed -i "s/buildDateTime = mkDefault .*/buildDateTime = mkDefault $(date +%s);/" flavors/lineageos/default.nix + - name: "Set NEW_BUILD_DATE_TIME variable" + run: echo "NEW_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV + - name: "Create Pull Request" + id: cpr + uses: peter-evans/create-pull-request@v3.10.1 + with: + commit-message: "lineageos: ${{ env.OLD_BUILD_NUMBER }} -> ${{ env.NEW_BUILD_NUMBER }}" + title: "lineageos: ${{ env.OLD_BUILD_NUMBER }} -> ${{ env.NEW_BUILD_NUMBER }}" + branch: "lineageos-${{ env.NEW_BUILD_NUMBER }}" + delete-branch : true + labels: "automated" + - name: "Check outputs" + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" From 85030485fadfdfa86d627a6874887f593a4d6263 Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 14 Apr 2025 16:44:12 +0200 Subject: [PATCH 2/5] stub it for testing --- .github/workflows/lineageos-update.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lineageos-update.yaml b/.github/workflows/lineageos-update.yaml index bda20dab..4d9d18cf 100644 --- a/.github/workflows/lineageos-update.yaml +++ b/.github/workflows/lineageos-update.yaml @@ -14,12 +14,12 @@ jobs: extra_nix_config: "experimental-features = nix-command flakes" - name: "Set OLD_BUILD_NUMBER variable" run: echo "OLD_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV - - name: "Fetch latest lineage-18.1 changes" - run: nix develop -c ./flavors/lineageos/update.sh lineage-18.1 - - name: "Fetch latest lineage-17.1 changes" - run: nix develop -c ./flavors/lineageos/update.sh lineage-17.1 + # - name: "Fetch latest lineage-18.1 changes" + # run: nix develop -c ./flavors/lineageos/update.sh lineage-18.1 + # - name: "Fetch latest lineage-17.1 changes" + # run: nix develop -c ./flavors/lineageos/update.sh lineage-17.1 - name: "Update buildDateTime" - run: sed -i "s/buildDateTime = mkDefault .*/buildDateTime = mkDefault $(date +%s);/" flavors/lineageos/default.nix + run: date +%s > flavors/lineageos/lineage-22.1/lastUpdated.epoch - name: "Set NEW_BUILD_DATE_TIME variable" run: echo "NEW_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV - name: "Create Pull Request" From 8abcc3e6443659786fc2dd770b8cec4a3a92e8cb Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 14 Apr 2025 16:54:11 +0200 Subject: [PATCH 3/5] newer nix-install action --- .github/workflows/lineageos-update.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/lineageos-update.yaml b/.github/workflows/lineageos-update.yaml index 4d9d18cf..712a825d 100644 --- a/.github/workflows/lineageos-update.yaml +++ b/.github/workflows/lineageos-update.yaml @@ -8,9 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.5 - - uses: cachix/install-nix-action@v14.1 + - uses: cachix/install-nix-action@v31.1.0 with: - install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211019_4a2b7cc/install extra_nix_config: "experimental-features = nix-command flakes" - name: "Set OLD_BUILD_NUMBER variable" run: echo "OLD_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV From ac36c7219a0ddb992ff3ac5fbc0f2bc74ff9e40a Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 14 Apr 2025 17:00:09 +0200 Subject: [PATCH 4/5] working eval --- .github/workflows/lineageos-update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lineageos-update.yaml b/.github/workflows/lineageos-update.yaml index 712a825d..3cd23baa 100644 --- a/.github/workflows/lineageos-update.yaml +++ b/.github/workflows/lineageos-update.yaml @@ -20,7 +20,7 @@ jobs: - name: "Update buildDateTime" run: date +%s > flavors/lineageos/lineage-22.1/lastUpdated.epoch - name: "Set NEW_BUILD_DATE_TIME variable" - run: echo "NEW_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV + run: echo "NEW_BUILD_NUMBER=$(nix eval -f . --arg configuration '{ flavor = "lineageos"; device = "foo"; androidVersion = 15; }' --raw config.buildNumber)" >> $GITHUB_ENV - name: "Create Pull Request" id: cpr uses: peter-evans/create-pull-request@v3.10.1 From 2483f5e71344777805779bda5a4c873822bf0979 Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 14 Apr 2025 17:41:16 +0200 Subject: [PATCH 5/5] old build number too --- .github/workflows/lineageos-update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lineageos-update.yaml b/.github/workflows/lineageos-update.yaml index 3cd23baa..d6252dde 100644 --- a/.github/workflows/lineageos-update.yaml +++ b/.github/workflows/lineageos-update.yaml @@ -12,7 +12,7 @@ jobs: with: extra_nix_config: "experimental-features = nix-command flakes" - name: "Set OLD_BUILD_NUMBER variable" - run: echo "OLD_BUILD_NUMBER=$(nix eval -f . --arg configuration "{flavor = \"lineageos\";}" --raw config.buildNumber)" >> $GITHUB_ENV + run: echo "OLD_BUILD_NUMBER=$(nix eval -f . --arg configuration '{ flavor = "lineageos"; device = "foo"; androidVersion = 15; }' --raw config.buildNumber)" >> $GITHUB_ENV # - name: "Fetch latest lineage-18.1 changes" # run: nix develop -c ./flavors/lineageos/update.sh lineage-18.1 # - name: "Fetch latest lineage-17.1 changes"