Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a Github action/workflow to automatically manala up on .manala changes #23

Open
ogizanagi opened this issue Oct 2, 2020 · 5 comments

Comments

@ogizanagi
Copy link
Member

So we won't even miss an update

@ogizanagi ogizanagi changed the title Provide a Github action to automatically manala up on .manala changes Provide a Github action/workflow to automatically manala up on .manala changes Oct 2, 2020
@nervo
Copy link
Member

nervo commented Oct 2, 2020

Wow, with a ready-to-merge pull request ?

With goreleaser, we could build a docker image, but before your issue, i've never seen a good reason to do it :)

@ogizanagi
Copy link
Member Author

Very basically introduced on-per-project basis with the following patch:

diff --git a/.github/actions/manala-up/action.yml b/.github/actions/manala-up/action.yml
new file mode 100644
index 000000000..3edd1e57b
--- /dev/null
+++ b/.github/actions/manala-up/action.yml
@@ -0,0 +1,16 @@
+name: Manala update
+description: 'Automatically run manala update on .manala.yml changes in case the developper forgot it'
+
+runs:
+  using: composite
+  steps:
+
+    - name: Install Manala binary
+      shell: bash
+      run: |
+        curl -sfL https://raw.githubusercontent.com/manala/manala/master/godownloader.sh | sh
+        echo "./bin/" >> $GITHUB_PATH
+
+    - name: Run Manala update
+      shell: bash
+      run: manala update
diff --git a/.github/workflows/manala-up.yml b/.github/workflows/manala-up.yml
new file mode 100644
index 000000000..84ebfe2ae
--- /dev/null
+++ b/.github/workflows/manala-up.yml
@@ -0,0 +1,32 @@
+name: Manala up
+on:
+  push:
+    branches:
+      - master
+    paths:
+      - '.manala.yaml'
+  pull_request:
+    paths:
+      - '.manala.yaml'
+
+jobs:
+  up:
+    runs-on: ubuntu-latest
+    steps:
+
+      - name: Checkout head
+        uses: actions/checkout@v2
+
+      - name: Setup & Run Manala update
+        uses: ./.github/actions/manala-up
+
+      # https://github.com/EndBug/add-and-commit
+      - name: Commit & push changes
+        uses: EndBug/add-and-commit@v4
+        with:
+          author_name: GitHub Actions Bot
+          author_email: actions@github.com
+          message: '[AUTO] By Github Actions: Run manala update'
+          add: ".manala/"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

We could provide an official action for Manala setup and add a way to generate the worflow automatically with the Manala CLI.

@nervo
Copy link
Member

nervo commented Oct 5, 2020

what about having a .manala/github/workflow/update.yaml available through the recipe ?

@ogizanagi
Copy link
Member Author

ogizanagi commented Oct 5, 2020

Sure, but the resulting path where to generate the workflow file has to be in the .github/workflow directory, so out of the .manala dir. I don't think there is any alternative available today.

@ogizanagi
Copy link
Member Author

Also, something interesting is Organization Workflows templates: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/sharing-workflows-with-your-organization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants