-
Notifications
You must be signed in to change notification settings - Fork 70
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
ci: add docker build action #549
Changes from 7 commits
7d31a75
e17c2a2
87a0e85
12637b4
bd813fc
969051b
db4b54a
24b2f82
e7f7f76
1fe5be9
eb4c31a
c466d39
e591c35
79dd887
b4847d1
2c92bc5
af771ab
fac2f92
dd85cf8
840aea6
a3ddedd
e12d13f
b176cb0
ecddef9
7bee441
e6cb3ec
64d5b41
fec7880
c50989f
f103af0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
.moon/cache | ||
.moon/docker | ||
**/.env | ||
.git |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Docker | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*-?v[0-9]+*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
name=ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=pr | ||
type=semver,pattern=v{{version}} | ||
type=semver,pattern=v{{major}}.{{minor}} | ||
type=semver,pattern=v{{major}} | ||
type=raw,value=unstable,enable={{is_default_branch}} | ||
|
||
- name: Build and push to ghcr | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,51 +113,11 @@ jobs: | |
run: | | ||
gh release upload ${{ github.ref_name }} "tmp/script.ryot.zip" | ||
|
||
docker-release: | ||
runs-on: ubuntu-latest | ||
needs: create-release | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get docker image name and build args | ||
id: required_args | ||
run: | | ||
image_name="${{ env.REGISTRY }}/${{ github.actor }}/${{ github.event.repository.name }}" | ||
image_names="$image_name:${{ github.ref_name }},$image_name:unstable" | ||
if [ "${{ needs.create-release.outputs.is-prerelease }}" = "false" ]; then | ||
image_names="$image_names,$image_name:latest" | ||
fi | ||
# lowercase the name | ||
image_names=$(echo "$image_names" | tr '[:upper:]' '[:lower:]') | ||
echo "image_names=$image_names" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push to ghcr | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.required_args.outputs.image_names }} | ||
|
||
# Mark the Github Release™ as a non-draft now that everything has succeeded! | ||
publish-release: | ||
# Only run after all the other tasks, but it's ok if upload-artifacts was skipped | ||
needs: | ||
[create-release, upload-artifacts, docker-release, upload-kodi-plugin] | ||
[create-release, upload-artifacts, upload-kodi-plugin] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we do away with cargo-dist in this release? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, what do you mean by "do away" ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I got it, never heard it before. The reason why I haven't touched it is because I don't have enough information about what it is doing, espcially the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep |
||
if: ${{ always() && needs.create-release.result == 'success' && (needs.upload-artifacts.result == 'skipped' || needs.upload-artifacts.result == 'success') }} | ||
runs-on: ubuntu-latest | ||
env: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tags (
v4.1
orv4.1.0
) are being released for PRs too. I think theenable
attribute needs to be used here?