Skip to content
This repository was archived by the owner on Aug 28, 2022. It is now read-only.

Commit bf0a7db

Browse files
authored
👷 Extract and upload artifacts from built image in GitHub workflow (#4)
* 🆙 Apply latest security updates to Laravel dependencies * 👷 Extract and upload artifacts from built image * 👷 Publish to GitHub Package repository when tagged * 👷 Add command to release new version using `make release`
1 parent c942fc1 commit bf0a7db

File tree

3 files changed

+845
-1444
lines changed

3 files changed

+845
-1444
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
1-
name: Docker Image
1+
name: Build Docker Image
2+
23
on: [push]
4+
35
jobs:
46
build:
57
runs-on: ubuntu-latest
68
steps:
79
- uses: actions/checkout@v2
8-
- name: Build image
9-
run: docker build --tag test .
10+
- name: Build & Publish If Tagged
11+
uses: docker/build-push-action@v1
12+
with:
13+
username: ${{ github.actor }}
14+
password: ${{ github.token }}
15+
registry: docker.pkg.github.com
16+
repository: ${{ github.repository }}/laravel
17+
tag_with_ref: true
18+
add_git_labels: true
19+
push: ${{ startsWith(github.ref, 'refs/tags/') }}
20+
- name: Extract Artifacts
21+
run: |
22+
IMAGE=$(docker images --format='{{.ID}}' | head -1)
23+
CONTAINER=$(docker create ${IMAGE})
24+
docker cp ${CONTAINER}:/srv/artifacts .
25+
- name: Upload Artifacts
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: 'build-artifacts'
29+
path: artifacts

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ serve:
2323
build:
2424
docker build . && (docker images --format='{{.ID}}' | head -1)
2525

26+
# Tag a new release of the application
27+
release:
28+
git fetch && \
29+
git tag -fsa v$(VERSION) -m 'v$(VERSION)' && \
30+
git push -f origin v$(VERSION)
31+
2632
# Run the application's quality check
2733
quality:
2834
${COMPOSER_COMMAND} quality

0 commit comments

Comments
 (0)