Skip to content
Open

Dev #19

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c126384
Bump plutus Version to 1.46.0.0 (#43)
github-actions[bot] May 14, 2025
9ba85f5
Bump plutus Version to 1.47.0.0 (#44)
github-actions[bot] Jun 17, 2025
1773d91
Bump plutus Version to 1.48.0.0 (#45)
github-actions[bot] Jun 26, 2025
eac94c2
Fix broken link in README.md (#47)
zeme-wana Jul 7, 2025
a00a580
Bump plutus Version to 1.49.0.0 (#48)
github-actions[bot] Jul 9, 2025
b0f813b
Integrate latest iogx version (#50)
zeme-wana Jul 17, 2025
020a37f
Expanded setup instructions (#51)
rober-m Jul 23, 2025
b946008
Bump plutus Version to 1.50.0.0 (#52)
github-actions[bot] Jul 23, 2025
ad18aba
Bump plutus Version to 1.51.0.0 (#53)
github-actions[bot] Aug 1, 2025
78f47a4
Add comprehensive GitHub Copilot instructions for plinth-template (#57)
Copilot Aug 14, 2025
53a5e5c
Upgrade Plutus Core to v1.1.0 and modernize PlutusLedgerApi imports (…
Unisay Aug 21, 2025
9c6272c
Bump plutus Version to 1.52.0.0 (#59)
github-actions[bot] Aug 28, 2025
62c632f
Bump plutus Version to 1.53.0.0 (#60)
github-actions[bot] Sep 8, 2025
524d28f
Bump plutus Version to 1.54.0.0 (#61)
github-actions[bot] Sep 22, 2025
3f25b33
Update Tutorial.md and add AuctionValidator.hs
Oct 4, 2025
7fc9595
Add AuctionTypes.hs with auction parameter, datum, and action types
Oct 4, 2025
c437fa8
upgraded
besiwims May 12, 2025
fd592ee
Update README.md
besiwims May 22, 2025
130defb
Update README.md
besiwims May 22, 2025
2d928e2
updated
besiwims May 22, 2025
911cd80
Add images to README.md
besiwims May 22, 2025
120c3cc
Checked the source code
besiwims Sep 15, 2025
fb12824
Updated
besiwims Sep 15, 2025
679843a
Add merged README.md file
besiwims Oct 9, 2025
c874183
Merge pull request #16 from MatimbaMtileni/feature/add-auction-types
MatimbaMtileni Oct 10, 2025
7e587f8
Main (#14)
Princevicks-Technologies Oct 12, 2025
1edf911
Update README.md (#17)
BinaryTech-Solutions Oct 12, 2025
3960a8e
Add and Updated 19 files: Tutorials and Tests files and the plinth-te…
besiwims Oct 13, 2025
0b06f48
Merge branch 'main' of https://github.com/besiwims/plutus-tx-template
besiwims Oct 13, 2025
53ac7b5
J'ai ajouté mon nom dans le readMe
mwatsimulamo Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
261 changes: 261 additions & 0 deletions .github/Tutorial github actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
# 🧰 **Automating Plutus Version Updates with GitHub Actions**

## 📑 **Table of Contents**

1. [🚀 Introduction](#1-introduction)
2. [⚙️ What is a GitHub Actions Workflow?](#2-what-is-a-github-actions-workflow)
3. [🎯 Why Use a Workflow for Plutus Version Updates?](#3-why-use-a-workflow-for-plutus-version-updates)
4. [🔁 How the “Bump Plutus Version” Workflow Works](#4-how-the-bump-plutus-version-workflow-works)

* 4.1 [⏯ Triggering the Workflow](#41-triggering-the-workflow)
* 4.2 [🧱 The Workflow Jobs and Steps](#42-the-workflow-jobs-and-steps)
5. [🔀 When to Use Each Merge Method](#5-when-to-use-each-merge-method)
6. [📜 Example Workflow YAML Explained](#6-example-workflow-yaml-explained)
7. [🪜 Commit Strategies: Merge, Squash, and Rebase](#7-commit-strategies-merge-squash-and-rebase)
8. [🧩 Example Diagrams](#8-example-diagrams)
9. [📚 Glossary of Terms](#9-glossary-of-terms)


## 🚀 **1. Introduction**

Modern projects often depend on external libraries such as **Plutus** (Cardano’s smart contract toolkit).
Each time a new Plutus version is released, you may need to **update** your `.cabal`, `cabal.project`, and `flake.lock` files.

Instead of updating these manually, you can **automate** the process using **GitHub Actions**, ensuring consistency, reproducibility, and zero manual errors.


## ⚙️ **2. What is a GitHub Actions Workflow?**

A **GitHub Actions workflow** is an automated process (defined in YAML) that runs one or more **jobs** based on **triggers**.

🔸 Each workflow:

* 📁 Lives in `.github/workflows/`
* 🧩 Defines tasks (build, test, publish, etc.)
* 🕹 Runs automatically or on-demand on GitHub’s servers


## 🎯 **3. Why Use a Workflow for Plutus Version Updates?**

| 💡 **Reason** | 🧭 **Description** |
| ----------------------------- | ------------------------------------------------------------------------------ |
| ⚙️ **Automation** | Avoids manual edits and reduces human error when updating Plutus dependencies. |
| 📏 **Consistency** | Follows the same process every time — edit → build → test → PR → merge. |
| 🧾 **Traceability** | Each change is documented in a PR with commits and version tags. |
| 🔄 **Continuous Integration** | Automatically integrates changes once all tests and checks pass. |


## 🔁 **4. How the “Bump Plutus Version” Workflow Works**

This workflow automates the **entire update pipeline** — from editing files to creating a PR and merging it automatically.


### ⏯ **4.1 Triggering the Workflow**

```yaml
on:
workflow_dispatch:
inputs:
version:
description: Plutus Release Version (e.g. 1.26.0.0)
required: true
```

**🎬 What Happens:**

* The workflow runs **manually** from the GitHub Actions tab.
* You must provide a **Plutus version number**, e.g. `1.26.0.0`.

**🧭 Why:**

* Manual triggering ensures control — you decide when to upgrade, preventing unwanted automatic updates.


### 🧱 **4.2 The Workflow Jobs and Steps**

#### 🧮 Job: `bump-plutus-version`

Runs on **Ubuntu** and performs a sequence of automated steps:

| 🪜 **Step** | ⚡ **Action** | 🧠 **Purpose** |
| ----------------------------- | ---------------------------------------------- | ---------------------------------------------------------------- |
| 🧰 **1. Checkout** | `actions/checkout@v4.1.1` | Pulls your repository into the workflow runner. |
| 🧩 **2. Change Versions** | `sed` shell commands | Updates `.cabal` and `cabal.project` files with the new version. |
| 🧱 **3. Install Nix** | `DeterminateSystems/nix-installer-action@main` | Installs **Nix** for reproducible dependency management. |
| 🔄 **4. Update Lock File** | `nix flake update` | Refreshes `flake.lock` for CHaP and Hackage sources. |
| 🧾 **5. Create Pull Request** | `peter-evans/create-pull-request@v6.0.5` | Commits, pushes, and opens a PR with the updated files. |
| 🤖 **6. Enable Auto-Merge** | `peter-evans/enable-pull-request-automerge@v3` | Automatically merges the PR after checks succeed. |


## 🔀 **5. When to Use Each Merge Method**

| 🔧 **Merge Method** | 🕒 **When to Use** | ✅ **Pros** | ⚠️ **Cons** |
| ------------------- | ------------------------------------------------- | ------------------------------------ | -------------------------------- |
| 🔗 **Merge** | When preserving full commit history is important. | Keeps all commit history. | Can clutter the commit graph. |
| 📦 **Squash** | For automated or small PRs like version bumps. | Creates a single clean commit. | Loses detailed commit breakdown. |
| 🪄 **Rebase** | When syncing local branches with `main`. | Produces a linear, readable history. | Risky on shared branches. |

Your workflow uses:

```yaml
merge-method: squash
```

✅ Ideal for **automated updates** — keeps the history clean and easy to review.


## 📜 **6. Example Workflow YAML Explained**

```yaml
name: Bump Plutus Version

on:
workflow_dispatch:
inputs:
version:
description: Plutus Release Version (e.g. 1.26.0.0)
required: true

jobs:
bump-plutus-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1

- name: Change Plutus Versions
run: |
CURRENT_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")
sed -i "s/\(hackage.haskell.org \).*\$/\1$CURRENT_DATE/" cabal.project
sed -i "s/\(cardano-haskell-packages \).*\$/\1$CURRENT_DATE/" cabal.project

PLUTUS_VERSION=${{ github.event.inputs.version }}
sed -i "s/\(plutus-core \).*\$/\1\^>=$PLUTUS_VERSION/" "plinth-template.cabal"
sed -i "s/\(plutus-ledger-api \).*\$/\1\^>=$PLUTUS_VERSION/" "plinth-template.cabal"
sed -i "s/\(plutus-tx \).*\$/\1\^>=$PLUTUS_VERSION/" "plinth-template.cabal"
sed -i "s/\(plutus-tx-plugin \).*\$/\1\^>=$PLUTUS_VERSION/" "plinth-template.cabal"

- uses: DeterminateSystems/nix-installer-action@main
- run: nix flake update CHaP hackage --accept-flake-config

- uses: peter-evans/create-pull-request@v6.0.5
with:
branch: "bump-plutus-${{ github.event.inputs.version }}"
title: Bump Plutus Version to ${{ github.event.inputs.version }}
commit-message: Bump Plutus Version to ${{ github.event.inputs.version }}
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}

- uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
token: ${{ secrets.GITHUB_TOKEN }}
```


## 🪜 **7. Commit Strategies: Merge, Squash, and Rebase**

### 🔗 **Merge (Default)**

```bash
git merge feature-branch
```

Creates a *merge commit* connecting both branches.

```
A---B---C---M
\ /
D---E
```


### 📦 **Squash (Used Here)**

```bash
git merge --squash feature-branch
git commit -m "Bump Plutus version"
```

Result:

```
A---B---C---S
```

Single clean commit — perfect for automation.


### 🪄 **Rebase**

```bash
git rebase main
```

Applies commits from your branch **on top of main**.

```
Before:
A---B---C
\
D---E

After:
A---B---C---D'---E'
```


## 🧩 **8. Example Diagrams**

### 🔧 **Workflow Overview**

```
┌────────────────────────────┐
│ Manual trigger (version) │
└────────────┬───────────────┘
┌────────────────────────────┐
│ Update cabal & flake.lock │
└────────────┬───────────────┘
┌────────────────────────────┐
│ Create branch + commit │
└────────────┬───────────────┘
┌────────────────────────────┐
│ Open Pull Request (PR) │
└────────────┬───────────────┘
┌────────────────────────────┐
│ Enable Auto-Merge (squash) │
└────────────┬───────────────┘
✅ PR merged → main branch updated
```


## 📚 **9. Glossary of Terms**

| 🧩 **Term** | 🧠 **Meaning** |
| ------------------------ | ---------------------------------------------------------- |
| 🦾 **GitHub Actions** | CI/CD platform built into GitHub for automation. |
| ⚙️ **Workflow** | A YAML-defined automation pipeline. |
| 🧱 **Job** | A group of steps executed on a single virtual environment. |
| 🪜 **Step** | A single shell command or GitHub action inside a job. |
| 🧊 **Nix** | Reproducible package manager used for Cardano projects. |
| 📦 **Flake** | A Nix configuration file describing project inputs. |
| 📁 **cabal.project** | File defining Haskell build dependencies. |
| 🔀 **PR (Pull Request)** | A request to merge code changes between branches. |
| 🤖 **Auto-Merge** | Automatically merges a PR once checks pass. |
| 📜 **Squash** | Combines multiple commits into one before merging. |


## ✅ **Summary**

This workflow:

* ⚙️ Automates **Plutus dependency updates**.
* 🧹 Keeps your main branch clean using **squash merges**.
* 🔁 Uses **GitHub Actions** and **Nix** for reproducibility.
* 💼 Saves developer time with automatic PR creation and merging.

Loading