Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit 60d124a

Browse files
authored
13 drop legacy build (#14)
* Updated README * Don't invoke the legacy action.
1 parent 941aa9e commit 60d124a

File tree

2 files changed

+42
-92
lines changed

2 files changed

+42
-92
lines changed

README.md

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This repository contains a simple GitHub Action implementation which allows you to attach binaries to a new (github) release of your repository.
44

5+
* [GitHub Action for Uploading Release Artifacts](#github-action-for-uploading-release-artifacts)
6+
* [Enabling the action](#enabling-the-action)
7+
* [Sample Configuration](#sample-configuration)
8+
* [GITHUB_TOKEN](#github_token)
9+
510

611
## Enabling the action
712

@@ -12,14 +17,11 @@ There are two steps required to use this action:
1217
* You'll specify a pattern to describe which binary-artifacts are uploaded.
1318
* Ensure your binary artifacts are generated.
1419
* Ideally you should do this in your workflow using another action.
15-
* But if you're in a hurry you can add a project-specific `.github/build` script.
16-
1720

18-
## Sample Configuration: Preferred
1921

20-
The following configuration file uses this action, along with another to build a project.
22+
## Sample Configuration
2123

22-
This is the preferred approach:
24+
The following configuration file uses _this_ action, along with the [github-action-build](https://github.com/skx/github-action-build) action to generate the artifacts for a project, then attach them to a release.
2325

2426
```
2527
on:
@@ -33,9 +35,9 @@ jobs:
3335
steps:
3436
- name: Checkout the repository
3537
uses: actions/checkout@master
36-
- name: Generate artifacts
38+
- name: Generate the artifacts
3739
uses: skx/github-action-build@master
38-
- name: Upload artifacts
40+
- name: Upload the artifacts
3941
uses: skx/github-action-publish-binaries@master
4042
env:
4143
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -51,56 +53,9 @@ This is the preferred approach because it uses a pair of distinct actions, each
5153
* [skx/github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries)
5254
* Uploads the previously-generated the build artifacts.
5355

54-
**NOTE**: Please see the note about GITHUB_TOKEN later.
55-
56-
57-
58-
## Sample Configuration: Legacy
59-
60-
In the past this action performed __both__ steps:
61-
62-
* Generated the artifacts
63-
* Uploaded the artifacts
64-
65-
That is still possible, but will be removed when actions come out of beta.
66-
67-
For the moment you can continue to work as you did before, add the script `.github/build` to your repository, and configure this action with a pattern of files to upload.
68-
69-
For example the following usage, defined in `.github/workflows/release.yml`, uploads files matching the pattern `puppet-summary-*`.
70-
71-
```
72-
on:
73-
release:
74-
types: [created]
75-
name: Handle Release
76-
jobs:
77-
upload:
78-
name: Upload Artifacts
79-
runs-on: ubuntu-latest
80-
steps:
81-
- uses: actions/checkout@master
82-
- name: Upload
83-
uses: skx/github-action-publish-binaries@master
84-
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86-
with:
87-
args: 'puppet-summary-*'
88-
```
89-
90-
We assume that the `.github/build` script generated suitable binaries. For example a go-based project might create files like this using cross-compilation:
91-
92-
* `puppet-summary-linux-i386`
93-
* `puppet-summary-linux-amd64`
94-
* `puppet-summary-darwin-i386`
95-
* `puppet-summary-darwin-amd64`
96-
* ....
97-
98-
99-
**NOTE**: Please see the note about GITHUB_TOKEN later.
100-
10156

10257
## GITHUB_TOKEN
10358

104-
Your workflow configuration file, named `.github/workflows/release.yml`, will contain a reference to `secrets.GITHUB_TOKEN`, however you do __not__ need to generate that, or update your project settings in any way.
59+
Your workflow configuration file, named `.github/workflows/release.yml`, will contain a reference to `secrets.GITHUB_TOKEN`, however you do __not__ need to generate that, or update your project settings in any way!
10560

10661
You _can_ inject secrets into workflows, defining them in the project settings, and referring to them by name, but the `GITHUB_TOKEN` value is special and it is handled transparently, requiring no manual setup.

upload-script

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,38 @@ fi
2626

2727

2828
#
29-
# In the past we invoked a build-script to generate artifacts.
29+
# In the past we invoked a build-script to generate the artifacts
30+
# prior to uploading.
3031
#
31-
# Now we prefer to assume they are built already. However if
32-
# there is a (legacy) build-script present AND the artifacts
33-
# we expect to find are missing then we will invoke it.
32+
# Now we no longer do so, they must exist before they are uploaded.
3433
#
35-
if [ -e .github/build ]; then
36-
37-
# Have we found any artifacts?
38-
found=
39-
for file in $*; do
40-
if [ -e "$file" ]; then
41-
found=1
42-
fi
43-
done
44-
45-
#
46-
# Run the build-script if we have no artifacts.
47-
#
48-
if [ -z "${found}" ]; then
49-
50-
echo "************************************************************"
51-
echo " artifacts are missing, but a legacy build-script was found."
52-
echo " launching build-script .."
53-
echo "************************************************************"
54-
55-
chmod 755 .github/build
56-
./.github/build
57-
58-
echo "************************************************************"
59-
echo " build-script completed"
60-
echo "************************************************************"
61-
else
62-
echo "*****************************************************************"
63-
echo " Artifacts are already present, skipping the legacy build-script."
64-
echo "*****************************************************************"
34+
# Test for them here.
35+
#
36+
37+
# Have we found any artifacts?
38+
found=
39+
for file in $*; do
40+
if [ -e "$file" ]; then
41+
found=1
6542
fi
43+
done
44+
45+
#
46+
# Abort if missing.
47+
#
48+
if [ -z "${found}" ]; then
49+
50+
echo "*****************************************************************"
51+
echo " "
52+
echo " Artifacts are missing, and this action no longer invokes the "
53+
echo " legacy-build script."
54+
echo " "
55+
echo " Please see the README.md file for github-action-publish-binaries"
56+
echo " which demonstrates how to build AND upload artifacts."
57+
echo " "
58+
echo "*****************************************************************"
59+
60+
exit 1
6661
fi
6762

6863
# Prepare the headers for our curl-command.
@@ -77,9 +72,9 @@ for file in $*; do
7772
echo "Processing file ${file}"
7873

7974
if [ ! -e "$file" ]; then
80-
echo "*****************************"
81-
echo " file not present - skipping."
82-
echo "*****************************"
75+
echo "***************************"
76+
echo " file not found - skipping."
77+
echo "***************************"
8378
continue
8479
fi
8580

0 commit comments

Comments
 (0)