Skip to content

Commit ec74b79

Browse files
committed
Consolidating gh-pages workflows
1 parent c274ac0 commit ec74b79

File tree

1 file changed

+9
-82
lines changed

1 file changed

+9
-82
lines changed

.github/workflows/workflow.yml

+9-82
Original file line numberDiff line numberDiff line change
@@ -44,96 +44,22 @@ jobs:
4444
update-gh-pages:
4545
runs-on: ubuntu-latest
4646
needs: build-executable
47-
if: github.event_name == 'push'
48-
4947
steps:
5048
# Step 1: Checkout the repository
5149
- name: Checkout repository
5250
uses: actions/checkout@v3
5351

54-
# Step 2: Update webpage content (no executable update)
55-
- name: Update webpage
52+
# Step 2: Fetch latest release URL
53+
- name: Fetch latest release URL
54+
id: fetch-latest-release
5655
run: |
57-
mkdir gh-pages
58-
echo '<!DOCTYPE html>
59-
<html lang="en">
60-
<head>
61-
<meta charset="UTF-8">
62-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
63-
<title>File Renamer</title>
64-
<style>
65-
body {
66-
font-family: Arial, sans-serif;
67-
margin: 0;
68-
padding: 0;
69-
text-align: center;
70-
background-color: #f9f9f9;
71-
color: #333;
72-
}
73-
header {
74-
background-color: #4CAF50;
75-
color: white;
76-
padding: 1rem;
77-
}
78-
main {
79-
padding: 2rem;
80-
}
81-
a.download-btn {
82-
display: inline-block;
83-
margin-top: 20px;
84-
padding: 10px 20px;
85-
color: white;
86-
background-color: #007BFF;
87-
text-decoration: none;
88-
border-radius: 5px;
89-
}
90-
a.download-btn:hover {
91-
background-color: #0056b3;
92-
}
93-
</style>
94-
</head>
95-
<body>
96-
<header>
97-
<h1>File Renamer</h1>
98-
</header>
99-
<main>
100-
<p>Welcome to the official page for <strong>File Renamer</strong>. Simplify file renaming with powerful features like metadata-based sorting and intuitive GUI support.</p>
101-
<h2>Download</h2>
102-
<p>The latest release is available below:</p>
103-
<a class="download-btn" href="rename_files.exe">Download File Renamer</a>
104-
<h2>Features</h2>
105-
<ul>
106-
<li>Renames files based on metadata like date taken.</li>
107-
<li>Supports multiple file formats, including images and videos.</li>
108-
<li>Provides fallback options for missing metadata.</li>
109-
</ul>
110-
<h2>Need Help?</h2>
111-
<p>For more information or to report bugs, visit the <a href="https://github.com/dcwelch/file_renamer/issues">GitHub Issues page</a>.</p>
112-
</main>
113-
</body>
114-
</html>' > gh-pages/index.html
115-
116-
- name: Deploy to GitHub Pages
117-
uses: peaceiris/actions-gh-pages@v3
118-
with:
119-
github_token: ${{ secrets.GITHUB_TOKEN }}
120-
publish_dir: gh-pages
56+
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/dcwelch/file_renamer/releases/latest | jq -r '.assets[] | select(.name | endswith(".zip")).browser_download_url')
57+
echo "LATEST_RELEASE_URL=${LATEST_RELEASE_URL}" >> $GITHUB_ENV
12158
122-
update-gh-pages-release:
123-
runs-on: ubuntu-latest
124-
needs: build-executable
125-
if: github.event_name == 'release'
126-
127-
steps:
128-
# Step 1: Checkout the repository
129-
- name: Checkout repository
130-
uses: actions/checkout@v3
131-
132-
# Step 2: Update webpage content with release executable
133-
- name: Update webpage with release executable
59+
# Step 3: Update webpage content
60+
- name: Update webpage
13461
run: |
13562
mkdir gh-pages
136-
cp dist/rename_files.exe gh-pages/
13763
echo '<!DOCTYPE html>
13864
<html lang="en">
13965
<head>
@@ -179,7 +105,7 @@ jobs:
179105
<p>Welcome to the official page for <strong>File Renamer</strong>. Simplify file renaming with powerful features like metadata-based sorting and intuitive GUI support.</p>
180106
<h2>Download</h2>
181107
<p>Click the button below to download the latest version:</p>
182-
<a class="download-btn" href="rename_files.exe">Download File Renamer</a>
108+
<a class="download-btn" href="'$LATEST_RELEASE_URL'">Download File Renamer</a>
183109
<h2>Features</h2>
184110
<ul>
185111
<li>Renames files based on metadata like date taken.</li>
@@ -192,6 +118,7 @@ jobs:
192118
</body>
193119
</html>' > gh-pages/index.html
194120
121+
# Step 4: Deploy to GitHub Pages
195122
- name: Deploy to GitHub Pages
196123
uses: peaceiris/actions-gh-pages@v3
197124
with:

0 commit comments

Comments
 (0)